Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Random Class Reference

The engine's pseudorandom number generator. More...

Public Member Functions

void SetSeed (integer seed)
 Sets the PRNG seed.
integer GetSeed ()
 Gets the PRNG seed.
decimal Max (number max)
 Gets a random number between 0.0 and a specified maximum, and advances the PRNG state.
decimal Range (number min, number max)
 Gets a random number between a specified minimum and a specified maximum, and advances the PRNG state.

Detailed Description

The engine's pseudorandom number generator.

This is preferred over Math's random functions if you require consistency, since Random can be seeded and utilizes a defined algorithm, which functions such as Math.Random cannot guarantee.

Member Function Documentation

◆ GetSeed()

integer Random.GetSeed ( )

Gets the PRNG seed.

Returns
Returns an integer value.

◆ Max()

decimal Random.Max ( number max)

Gets a random number between 0.0 and a specified maximum, and advances the PRNG state.

Parameters
maxMaximum non-inclusive value.
Returns
Returns a decimal value.

◆ Range()

decimal Random.Range ( number min,
number max )

Gets a random number between a specified minimum and a specified maximum, and advances the PRNG state.

Parameters
minMinimum non-inclusive value.
maxMaximum non-inclusive value.
Returns
Returns a decimal value.

◆ SetSeed()

void Random.SetSeed ( integer seed)

Sets the PRNG seed.

Parameters
seedThe seed.