The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



BRandom


Unit:SDL_math1
Class:None
Declaration:function BRandom (p: double): boolean;

Sometimes it is convenient to have a function which returns a boolean value with a given probability. The function BRandom returns a TRUE with a probability p. p may have values in the range of 0.0 to 1.0; for values of p less than 0.0 or higher than 1.0 FALSE or TRUE are returned.

Hint: BRandom is based on the built-in random generator of Delphi. So any flaw in this random generator will also emerge in the distribution of values of BRandom.


Last Update: 2023-Feb-06