gaussdev (replaces TGaussDev)
The gaussdev function returns a 1-dimensional array of random numbers distributed according to a Gaussian probability density function. These values are known as "Gaussian Deviates". The larger the number of values created, the more perfectly they will approximate a Gaussian normal distribution. The related gaussdev1 function returns a single gaussian deviate.
tbl = gaussdev( nCount )
tbl = gaussdev( nCount, nStdDev )
tbl = gaussdev( nCount, nStdDev, nMean )
nCount is the number of Gaussian Deviates to create.
nStdDev is the standard deviation. If omitted, it defaults to 1.0.
nMean is the mean value. If omitted, it defaults to 0.0.
tbl is the returned array containing nCount values.
On failure, nil is returned.
The following script creates 1 million Gaussian random deviates using the CHistogram class and then plots the histogram. The default histogram binning options are using. The automatic binning computes the minimum and maximum of the values and selects the number of bins between, Since these values are automatic, the script must retrieve the histogram binning to create the plot. A quick method for creating a histogram and plotting it uses the histplot function.
|
-- create 1 million random deviates |
|
-- create a Histogram object |
|
-- compute the histogram |
|
-- separate the 3 parameters for clarity |
|
|
|
|
|
-- create a series for the histgram x axis |
|
-- plot the histogram as a connected plot |
|
|
Below is the result of running this script. The plot uses default labels as they were not specified by the plot function call.
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.