Difference between revisions of "RandG"

From SCAR Divi Manual
Jump to: navigation, search
(Description)
(Description)
 
Line 8: Line 8:
  
 
==Description==
 
==Description==
Generates a random [[extended]] value from the range [0, 1] using normal distribution with a given '''Variance'''. If the variance is lower, the random values will have bigger change of being closer to 0. The algorithm to calculate this is based on the [http://en.wikipedia.org/wiki/Gaussian_function Gaussian function].
+
Generates a random [[extended]] value from the range [0, 1] using normal distribution with a given '''Variance'''. If the variance is lower, the random values will have bigger chance of being closer to 0. The algorithm to calculate this is based on the [http://en.wikipedia.org/wiki/Gaussian_function Gaussian function].
  
 
==Example==
 
==Example==

Latest revision as of 23:47, 19 October 2011

Definition

function RandG(const Variance: Extended): Extended;

Availability

SCAR Divi 3.28 > Current

Description

Generates a random extended value from the range [0, 1] using normal distribution with a given Variance. If the variance is lower, the random values will have bigger chance of being closer to 0. The algorithm to calculate this is based on the Gaussian function.

Example

var
  i: Integer;

begin
  for i := 1 to 100 do
    WriteLn(RandG(2));
end.

See Also