norm reverse

random (replaces TRandom)


The random function returns a 1-dimensional array containing random numbers distributed according to a uniform probability density function. The related random1 function returns a single uniformly distributed random number.

Syntax

tbl = random( nCount )

tbl = random( nCount, nMin, nMax )

bullet.gif    nCount is the number of random numbers.

bullet.gif    nMin, nMax are the lower and upper limiting values in the array. if omitted, random numbers are created in the range [0, ..., 1 ].

bullet.gif    tbl is a 1-dimensional array containing nCount values.

bullet.gif    On failure, nil is returned.

Example

The following script creates 1 million random numbers, creates a histogram of the values, and plots their histogram.

y = random( 1000000 )

-- create 1 million random deviates

H = new_histogram()

-- create a Histogram object

h = H:Calc( y )

-- compute the histogram

plot( x, h )

-- plot the histogram

H:delete()

 

Related Topics

Table and Array Functions

random1

series

gaussdev

CStats class

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.