ISmBinomialDistribution.Probability

Syntax

Probability: Double;

Description

The Probability property determines success probability.

Comments

This value should belong to the range: [0; 1].

Example

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

Class OBJ16091Form: Form
    ChartBox1: ChartBox;
    UiChart1: UiChart;
    BiNorm: SmBinomialDistribution;
    Values: Array Of Double;
    Const Cnt = 100;

    Sub OBJ18694FormOnCreate(Sender: Object; Args: IEventArgs);
    Begin
        BiNorm := New SmBinomialDistribution.Create;
        Text := BiNorm.DisplayName;
        Binorm.Probability := 0.5;
        Binorm.Trials := 100;
        Values := BiNorm.RandomVector(Cnt);
        UiChart1.PointCount := cnt;
    End Sub OBJ18694FormOnCreate;

    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 OBJ16091Form;

After executing the example a binomial distribution graph is built:

See also:

ISmBinomialDistribution