\polygen

Simple value generation


Strings

$ curl https://polygen.dev/api/generate -d 'string/names'
"Madeline Grady"

$ curl https://polygen.dev/api/generate -d 'string/words(some(person/name))'
"Erna Orn Alice Hickle Cleta Eichmann"

Numbers

$ curl https://polygen.dev/api/generate -d 'float/32'
-1.518946815680129e38

$ curl https://polygen.dev/api/generate -d 'int'
2077978484615778

Using guards


Guards are a suffix to the generators you've used above. You separate them with : and you can use it multiple times (as long as it's applicable).


This generates a number between 10 and 30:

$ curl https://polygen.dev/api/generate -d 'int:gt(10):lt(30)'
17

More complex forms


Return will either be a "baby", a "child" or the age of the adult. (~33.3% likelihood of generating either)

$ curl https://polygen.dev/api/generate -d 'or("baby", "child", int/u8:lt(128))'
"child"