JMDash Random

The JMDash Random library is JM-'s way to generate random stuff, and can be included in a JM- Project using: #incd .jran

If something isn't clear about the syntax shown below, we recommend you to check out the examples category

Syntax & Examples

.jran : Common use cases, and syntax examples;

// Generate a random integer, syntax example
#incd .jran
int randomNumber;
ran.int(length(min=1, max=<maxLength>)){>> randomNumber};

/* Syntax explanations:

Available arguments for ran.int are;
ran.int( length( min=<minLength>, max=<maxLength> ) ){ >> <varName> };
ran.int( inNums( min=<firstNumber>, max=<lastNumber> ) ){ >> <varName> };

length() is used to define the length of the output integer
inNums() is used to limit the range of available numbers

Only length() must be defined, if inNums() is not defined ran.int will use a random range */
// Generate a random string, syntax example
#incd .jran
str randomString;
ran.str(length(min=1, max=5), specialCharacters=false){>> randomString};

/* Syntax explanations:

Available arguments for ran.int are;
ran.str( length( min=<minLength>, max=<maxLength> ) ){ >> <varName> };
ran.str( specialCharacters=<true/false> ){ >> <varName> };

length() is used to define the length of the output string
specialCharacters is needed in order for ran.str to know whether to use or not special characters (e.g. "@")

Both options must be defined in order for ran.str to work */

Last updated