I want to generate a random number with range and with a given probability in octave but I'm not sure how to:
0.5 chance of 1 - 50
0.3 chance of 51 - 80
0.2 chance of 81 - 100
thx
I want to generate a random number with range and with a given probability in octave but I'm not sure how to:
0.5 chance of 1 - 50
0.3 chance of 51 - 80
0.2 chance of 81 - 100
thx
Use randi
to generate those integers in combination with randsample
(from Statistics package) to define that bias.
pkg load statistics;
R = randsample([randi(50), randi([51 80]), randi([81 100])], 1, true, ...
[0.50, 0.3, 0.2]);