Love2D APIRandomGeneratorOn this pageRandomGenerator Description: A random number generation object which has its own random state. type Type: Function. Description: Gets the type of the object as a string. Signature: type: function(self: RandomGenerator): string Returns: Return TypeDescriptionstringThe type as a string. Of Type: Function. Description: Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. Signature: typeOf: function(self: RandomGenerator, type_name: string): boolean Parameters: ParameterTypeDescriptiontype_namestringThe name of the type to check for. Returns: Return TypeDescriptionbooleanTrue if the object is of the specified type, false otherwise. release Type: Function. Description: Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector. Signature: release: function(self: RandomGenerator): boolean Returns: Return TypeDescriptionbooleanTrue if the object was released by this call, false if it had been previously released. random Type: Function. Description: Generates a pseudo-random number in a platform independent manner. Signature: random: function(self: RandomGenerator): number Returns: Return TypeDescriptionnumbernumber — The pseudo-random number. random Type: Function. Description: Generates a pseudo-random number in a platform independent manner. Signature: random: function(self: RandomGenerator, upper: number): number Parameters: ParameterTypeDescriptionuppernumberThe maximum possible value it should return. Returns: Return TypeDescriptionnumberThe pseudo-random integer number. random Type: Function. Description: Generates a pseudo-random number in a platform independent manner. Signature: random: function(self: RandomGenerator, lower: number, upper: number): number Parameters: ParameterTypeDescriptionlowernumberThe minimum possible value it should return.uppernumberThe maximum possible value it should return. Returns: Return TypeDescriptionnumberThe pseudo-random integer number. randomNormal Type: Function. Description: Get a normally distributed pseudo random number. Signature: randomNormal: function(self: RandomGenerator, standard_deviation?: number, mean?: number): number Parameters: ParameterTypeDescriptionstandard_deviationnumberStandard deviation of the distribution. (Default: 1.)meannumberThe mean of the distribution. (Default: 0.) Returns: Return TypeDescriptionnumberNormally distributed random number with variance (stddev)² and the specified mean. setSeed Type: Function. Description: Sets the seed of the random number generator using the specified integer number. Signature: setSeed: function(self: RandomGenerator, seed: number) Parameters: ParameterTypeDescriptionseednumberThe integer number with which you want to seed the randomization. Must be within the range of 2^53. setSeed Type: Function. Description: Sets the seed of the random number generator using the specified integer number. Signature: setSeed: function(self: RandomGenerator, low: number, high: number) Parameters: ParameterTypeDescriptionlownumberThe lower 32 bits of the seed value. Must be within the range of 2^32 - 1.highnumberThe higher 32 bits of the seed value. Must be within the range of 2^32 - 1. getSeed Type: Function. Description: Gets the seed of the random number generator object. The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1. Signature: getSeed: function(self: RandomGenerator): number, number Returns: Return TypeDescriptionnumberInteger number representing the lower 32 bits of the RandomGenerator's 64 bit seed value.numberInteger number representing the higher 32 bits of the RandomGenerator's 64 bit seed value. setState Type: Function. Description: Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE. This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value. Overload details: The effect of the state string does not depend on the current operating system. Signature: setState: function(self: RandomGenerator, state: string) Parameters: ParameterTypeDescriptionstatestringThe new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState. getState Type: Function. Description: Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE. This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number. Overload details: The value of the state string does not depend on the current operating system. Signature: getState: function(self: RandomGenerator): string Returns: Return TypeDescriptionstringThe current state of the RandomGenerator object, represented as a string.