Stat Assembly > Stat Assembly Interfaces > IDistribution > IDistribution.Random
Random: Double;
The Random property returns a random number corresponding to a distribution.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
Distr: IDistribution;
Uniform: SmUniformDistribution;
Values: Array Of Double;
d0: Double;
i: Integer;
Const Cnt = 10;
Begin
Uniform := New SmUniformDistribution.Create;
Uniform.A := 0.8;
Uniform.B := 1.4;
Distr := Uniform;
Values := Distr.RandomVector(Cnt);
For i := 0 To Values.Length - 1 Do
d0 := Values[i];
Debug.WriteLine(d0);
End For;
Debug.WriteLine("Random number: " + d0.ToString);
End Sub UserProc;
After executing the example the console window displays random number vector and the random number corresponding to distribution:
Unit execution started
1,2184262808878
1,00027958350256
0,971868008887395
1,39371337075718
1,16480676741339
1,12695003822446
1,07897159797139
1,24510682192631
1,2083841281943
1,12512587206438
Random number: 1.12512587206438
Unit execution finished
See also: