Difference between revisions of "RandG"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function RandG(const Variance: Extended): Extended; </source> ==Availability== SCAR Divi 3.28 > Current ==Description== Genera...")
 
(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 Gauss 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 change 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==

Revision as of 22:46, 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 change 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