Difference between revisions of "RandomRangeG"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> function RandomRangeG(const AFrom, ATo: Integer; const Variance: Extended): Integer; </source> ==Availability== SCAR Divi 3.28 ...") |
(→Example) |
||
Line 16: | Line 16: | ||
begin | begin | ||
− | for i := 1 to | + | for i := 1 to 10 do |
WriteLn(RandomRangeG(1, 100, 2)); | WriteLn(RandomRangeG(1, 100, 2)); | ||
end. | end. |
Latest revision as of 00:50, 2 November 2011
Definition
function RandomRangeG(const AFrom, ATo: Integer; const Variance: Extended): Integer;
Availability
SCAR Divi 3.28 > Current
Description
Returns a random number from the range [AFrom, ATo - 1] using normal distribution with a given Variance. If the variance is lower, the random values will have bigger chance of being closer to AFrom. The algorithm to calculate this is based on the Gaussian function.
Example
var i: Integer; begin for i := 1 to 10 do WriteLn(RandomRangeG(1, 100, 2)); end.