Random number generator object.
An efficient Mersenne Twister implementation using the Java Random interface.
The original authors are Takuji Nishimura and Makoto Matsumoto
The library itself is a constructor that returns a '''Random''' object. It is not necessary to use ''new'' before the constructor.
var Random = ;var random = 42;
The Random object implements next(), nextInt(), and nextBoolean() as per Java's API. nextElement and shuffle are some random functions that are often done to arrays. Each element in the range has an equal chance of being selected.
'''next()''' - Returns a value between [0..1) in increments of 2^-32. '''nextInt(length = 4294967295) ''' - Returns an int between [0..length). '''nextBoolean()''' - Returns either true or false.
'''nextElement(list)''' - Returns an element from the list. '''nextElements(list, count)''' - Returns a new array with ''count'' random elements from ''list''.
'''shuffle(array)''' - Returns a new array with the contents of the passed in array shuffled. '''shuffleInPlace(list)''' - As the name says, shuffles a list in place, mutating the list.