To develop a random generator on Perchance, you need to set up lists and reference these lists within an output
section. For example:
output
Your \[pack\] contains \[item\], \[item\] and \[item\].
item
a few coins
an old \{silver|bronze\} ring
a handkerchief
a shard of bone
some lint
a tin of tea leaves
pack
purse
backpack
bag
pack
knapsack
rucksack
In this setup, whenever \[pack\]
is invoked, it will select a random item from the pack
list. You can modify the lists and syntax according to your specific needs.
To change the probability of certain items being selected, you can assign weights. For instance:
pack
purse
backpack ^2
bag
In this configuration, backpack
will be twice as likely to appear as other items in the pack
list.
Perchance allows the import of external generators using the import:
syntax. Example:
sentence
I need a new \{import:noun\}.
Quickly, \{import:verb\}!
noun
car
house
book
verb
run
jump
swim
This example integrates random noun
and verb
from other generators into new sentences.
Perchance supports text formatting options like:
sentence
\[name.titleCase\], can you hear me?
HELLO, \[name.upperCase\]!
name
patricia
khalid
anaya
Here, titleCase
and upperCase
functions alter the capitalization of names.
Generators can be shared by providing their URL. To embed a generator in a website, use the following <iframe>
tag:
<iframe src="https://null.perchance.org/my-generator-name" style="width:100%; height:600px; border:none;"></iframe>
Additionally, you can download the generator as an HTML file for offline access or convert it into a Twitter or Tumblr bot.