TRandom
Random number generator
By creating multiple TRandom objects, multiple independent random number generators can be used in parallel.
Methods
Method RndFloat:Float() Abstract
Generate random float
Returns
A random float in the range 0 (inclusive) to 1 (exclusive)
Method RndDouble:Double() Abstract
Generate random double
Returns
A random double in the range 0 (inclusive) to 1 (exclusive)
Method Rnd:Double(minValue:Double = 1, maxValue:Double = 0) Abstract
Generate random double
The optional parameters allow you to use Rnd in 3 ways:
| Format | Result |
| `Rnd()` | Random double in the range 0 (inclusive) to 1 (exclusive) |
| `Rnd(x)` | Random double in the range 0 (inclusive) to n (exclusive) |
| `Rnd(x,y)` | Random double in the range x (inclusive) to y (exclusive) |
Returns
A random double in the range min (inclusive) to max (exclusive)
Method Rand:Int(minValue:Int, maxValue:Int = 1) Abstract
Generate random integer
The optional parameter allows you to use Rand in 2 ways:
| Format | Result |
| `Rand(x)` | Random integer in the range 1 to x (inclusive) |
| `Rand(x,y)` | Random integer in the range x to y (inclusive) |
Returns
A random integer in the range min (inclusive) to max (inclusive)
Method SeedRnd(seed:Int) Abstract
Set random number generator seed
Method RndSeed:Int() Abstract
Get random number generator seed
Used in conjunction with SeedRnd, RndSeed allows you to reproduce sequences of random numbers.
Returns
The current random number generator seed
Method GetName:String() Abstract
Gets the name of this random number generator
