Random Numbers Generator Psytronics



One mathematical function in C programming that’s relatively easy to grasp is the rand function. It generates random numbers. Though that may seem silly, it’s the basis for just about every computer game ever invented. Random numbers are a big deal in programming. The Random Number Generator produces a Random Number Table consisting of 500 unique random numbers between 1 and 20,000. We will survey the families represented by these numbers - a sample of 500 families randomly selected from the population of 20,000 families.

Random

Random Numbers

[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index]Reference for unit 'System' (#rtl)

Generate random number

Declaration

Source position: systemh.inc line 848

Random

Programmable Random Number Generator

function Random(

l: LongInt

):LongInt;
function Random(

l: Int64

):Int64;
function Random: extended;

Description

Random returns a random number larger or equal to 0 and strictly less than L. For negative values of L the behaviour is undefined. If the argument L is omitted, a Real number between 0 and 1 is returned (0 included, 1 excluded).

Remark:

The Free Pascal implementation of the Random routine uses a Mersenne Twister algorithm to simulate randomness. This implementation has a better statistical distribution than for example a Linear Congruential generator algorithm, but is considerably slower than the latter. If speed is an issue, then alternate random number generators should be considered.

Note that the fact that a Mersenne Twister is used is an implementation detail, which can be changed at any point. The only guarantee Random() offers is that setting randseed to particular value will result in the same sequence of random numbers in a particular version the RTL. A newer version of the RTL may result in a different sequence for the same randseed.

Random numbers generator in excel

Errors

None.

Programmable random number generator

See also

Tausworthe Random Number Generator

Initialize random number generator

Example

Documentation generated on: Jun 22 2020



Comments are closed.