IDistribution.RandomVector

Syntax

RandomVector(Count: Integer): Array;

Parameters

Count. Vector length.

Description

The RandomVector method returns the vector of random numbers corresponding to the distribution.

Example

To execute the example, the form must have the ChartBox component and the UiChart component which serves as the source for ChartBox.

Class MyForm: Form

ChartBox1: ChartBox;

UiChart1: UiChart;

Uniform: SmUniformDistribution;

Values: Array Of Double;

Const Cnt = 10;

Sub MyFormOnCreate(Sender: Object; Args: IEventArgs);

Begin

Uniform := New SmUniformDistribution.Create;

Text := Uniform.DisplayName;

Uniform.A := 0.1;

Uniform.B := 0.8;

Values := Uniform.RandomVector(Cnt);

UiChart1.PointCount := cnt;

End Sub MyFormOnCreate;

Sub UiChart1OnGetDataValue(Sender: Object; Args: IUiChartGetDataValueEventArgs);

Begin

If Args.PointIndex < Cnt Then

Args.Value := Values[Args.PointIndex];

Args.Result := True;

End If;

End Sub UiChart1OnGetDataValue;

End Class MyForm;

After executing the example a uniform distribution graph is created for the value:

See also:

IDistribution