randomDigit

Generates a random integer from 0 until 9.

{"type": "randomDigit"}

// an integer between 0 and 9

randomDigitNot

Generates a random integer from 0 until 9, excluding a given number.

{"type": "randomDigitNot", "params":[2]}

// 0, 1, 3, 4, 5, 6, 7, 8 or 9

randomDigitNotNull

Generates a random integer from 1 until 9.

{"type": "randomDigitNotNull"}

// an integer between 1 and 9

randomNumber

Generates a random integer, containing between 0 and nbDigits amount of digits. When the strict parameter is true, it will only return integers with $nbDigits amount of digits.

{"type": "randomNumber", "params":[5, false]}

// 123, 43, 19238, 5, or 1203

{"type": "randomNumber", "params":[5, true]}

// 12643, 42931, or 32919

randomFloat

Generates a random float. Optionally it’s possible to specify the amount of decimals. The second and third parameters optionally specify a lower and upper bound respectively.

{"type": "randomFloat"}

// 12.9830, 2193.1232312, 102.12

{"type": "randomFloat", "params":[2]}

// 43.23, 1203.49, 3428.93

{"type": "randomFloat", "params":[1, 20, 30]}

// 21.7, 27.2, 28.1

numberBetween

Generates a random integer between min and max. By default, an integer is generated between 0 and 2,147,483,647 (32-bit integer).

{"type": "numberBetween"}

// 120378987, 182, 102310983

{"type": "numberBetween", "params":[0, 100]}

// 32, 87, 91, 13, 75

randomLetter

Generates a random character from the alphabet.

{"type": "randomLetter"}

// 'h', 'i', 'q'

randomElements

Returns count amount of random element from the given array, traversable, or enum. By default, the count parameter is set to 1, when null a random number of elements is returned.

{"type": "randomElements", "params": [['a', 'b', 'c', 'd', 'e']]}

// ['c']

{"type": "randomElements", "params": [['a', 'b', 'c', 'd', 'e'], null]);

// ['c', 'a', 'e']

randomElement

Returns a random element from the given array, traversable, or enum.

{"type": "randomElement", "params": [['a', 'b', 'c', 'd', 'e']]}

// 'c'

randomKey

Returns a random key from the given array.

{"type": "randomKey", "params":[{'a': 1, 'b': 2, 'c': 3}]}

// 'b'

shuffle

Returns a shuffled version of either an array or string.

{"type": "shuffle", "params": ['hello-world']}

// 'lrhoodl-ewl'

{"type": "shuffle", "params": [[1, 2, 3]]}

// [3, 1, 2]

numerify

Generate a string where all # characters are replaced by digits between 0 and 9. By default, ### is used as input.

{"type": "numerify"}

// '912', '271', '109', '674'

{"type": "numerify", "params": ['user-####']}

// 'user-4928', 'user-3427', 'user-1280'

lexify

Generate a string where all ? characters are replaces with a random letter from the Latin alphabet. By default, ???? is used as input.

{"type": "lexify"}

// 'sakh', 'qwei', 'adsj'

{"type": "lexify", "params": ['id-????']}

// 'id-xoqe', 'id-pqpq', 'id-zpeu'

bothify

Generate a string where ? characters are replaced with a random letter, # characters are replaced with a random digit between 0 and 9, and * characters are replaced with either a random letter or a random digit. By default, ## ?? is used as input.

{"type": "bothify"}

// '46 hd', '19 ls', '75 pw'

{"type": "bothify", "params": ['?????-#####']}

// 'lsadj-10298', 'poiem-98342', 'lcnsz-42938'

asciify

Generate a string where * characters are replaced with a random character from the ASCII table. By default, **** is used as input.

{"type": "asciify"}

// '%Y+!', '{<"B', 'kF^a'

{"type": "asciify", "params": ['user-****']};

// 'user-ntwx', 'user-PK`A', 'user-n`,X'

regexify

Generate a random string based on a regex. By default, an empty string is used as input.

{"type": "regexify"}

// ''

{"type": "regexify", "params": ['[A-Z]{5}[0-4]{3}']};

// 'DRSQX201', 'FUDPA404', 'CQVIU411'