Rand¶
Definition¶
Extends¶
Extended By¶
None
Method Summary¶
Owner | Name | Return Type | Description |
---|---|---|---|
Rand | constructor(seed, secure) | Rand | Creates a new Randomizer, used for generating random numbers. If a seed is provided, then the numbers generated are the same across runs. |
Object | getClassName() | String | Returns the string name of this object's class type. |
Rand | nextBoolean() | Boolean | Returns a random Boolean value. |
Rand | nextDouble(min, max) | Double | Returns a random Double between min and max values. |
Rand | nextGaussian() | Double | Return a random signed Double with a mean of 0 and standard deviation of 1. |
Rand | nextGuid() | String | Returns a random string. |
Rand | nextInt(min, max) | Integer | Returns a random Integer between min and max values. |
Rand | nextUUID() | UUID | Returns a randomly generated version 4 UUID object. |
Rand | shuffle(list) | List | Returns a new list with the values' positions randomly shuffled. |
Object | toJson() | String | Returns a string of a json representation of this object. |
Method Definitions¶
constructor(seed,secure)¶
Rand rand = new Rand(Number seed, Boolean secure)
Description¶
Creates a new Randomizer, used for generating random numbers. If a seed is provided, then the numbers generated are the same across runs.
Parameter Definition¶
Name | Type | Description |
---|---|---|
seed | Number | seed for repeatability. If nullm then the seed is random |
secure | Boolean | if true, then secure. if null or false, then not secure |
Example 1¶
Example 2¶
getClassName()¶
Description¶
Returns the string name of this object's class type.
Example 14¶
nextBoolean()¶
Description¶
Returns a random Boolean value.
Example 1¶
nextDouble(min,max)¶
Double Rand::nextDouble(Number min, Number max)
Description¶
Returns a random Double between min and max values.
Parameter Definition¶
Name | Type | Description |
---|---|---|
min | Number | minimum number to be returned (inclusive). If null, then 0 |
max | Number | maximum number to be returned (exclusive). If null, then 1 |
Example 1¶
nextGaussian()¶
Description¶
Return a random signed Double with a mean of 0 and standard deviation of 1.
Example 1¶
nextGuid()¶
Description¶
Returns a random string.
Example 1¶
nextInt(min,max)¶
Integer Rand::nextInt(Number min, Number max)
Description¶
Returns a random Integer between min and max values.
Parameter Definition¶
Name | Type | Description |
---|---|---|
min | Number | minimum number to be returned (inclusive). If null, then 0 |
max | Number | maximum number to be returned (exclusive). If null, then 1 |
Example 1¶
nextUUID()¶
Description¶
Returns a randomly generated version 4 UUID object.
Example 1¶
shuffle(list)¶
Description¶
Returns a new list with the values' positions randomly shuffled.
Parameter Definition¶
Name | Type | Description |
---|---|---|
list | List | list of values to shuffle |
Example 1¶
toJson()¶
Description¶
Returns a string of a json representation of this object.