Random
|
Statistical functions |
SYNTAX | Random( seed = Null ) |
RETURNS | ARRAY |
FUNCTION | Returns an array of random values in 0..1 range (to get single
random value use LastValue( Random() ) ) Seed is defined it initializes the seed of random number generator this allows to produce repetitive series of pseudo-random series. If seed is not specified - random number generator continues generation. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. |
EXAMPLE | Example 1:
Example 2:
|
SEE ALSO | mtRandom() function |
Tomasz Janeczko tj --at-- amibroker.com 2007-02-27 09:42:14 | Internally Random() function uses Microsoft C runtime library rand() function scaled to cover 0..1 range: (1.0*rand()/RAND_MAX) Now Microsoft's rand() function (used in all MS languages) is Linear Congruential Pseudo-Random Number Generator coded using 32 bit integer arithmetic as follows: static long holdrand; int rand() { holdrand = holdrand * 214013 + 2531011; return ( holdrand >> 16 ) & 0x7fff; } |
The Random function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.