<< NL_F_PointOfPolygon NL_F: Function NL_F_RandInt1n >>

NARVAL >> NL_F: Function > NL_F_RandDistribution

NL_F_RandDistribution

Generate a random value in respect with a given distribution.

Calling Sequence

[R] = NL_F_RandDistribution(V,N)

Arguments

V :

Vector of values.

N :

Vector of their occurence probability.

R :

Random value.

Description

NL_F_RandDistribution generates the random value R in respect with the given distribution , combined with the corresponding range of values . The probability to generate the value is .

Examples

i=[1 2 3 4 5];//values
v=[4 7 8 19 3];//occurrence vector
//probabilities
//sum(v)=41 --> 100/100
//i=1 --> 4/41
//i=2 --> 7/41
//i=3 --> 8/41
//i=4 --> 19/41
//i=5 --> 3/41
[n]=NL_F_RandDistribution(i,v)//application of NL_F_RandDistribution

Report an issue
<< NL_F_PointOfPolygon NL_F: Function NL_F_RandInt1n >>