![]() |
AIRandomBellCurveSuite Struct Reference
|
Public Attributes | |
AIAPI AIFixed(* | FixedRndBellCurve )(void) |
Gets a random number with normal probability distribution centered on zero and with a standard deviation of one. | |
AIAPI void(* | SetRndSeedBellCurve )(ai::int32 seed) |
Sets the random number seed used to generate subsequent random numbers. | |
AIAPI ai::int32(* | GetRndSeedBellCurve )(void) |
Retrieves the current random-number seed. |
Together with the AIRandomSuite
, allows you to add a degree of randomness, or "noise" to an effect.
This suite provides numbers distributed along a standard probability curve (as opposed to an even distribution of random numbers).
SPBasicSuite::AcquireSuite()
with the constants kAIRandomBellCurveSuite
and kAIRandomBellCurveVersion
. AIAPI AIFixed(* AIRandomBellCurveSuite::FixedRndBellCurve)(void) |
Gets a random number with normal probability distribution centered on zero and with a standard deviation of one.
(Note that this function returns a numeric value, not an error code.)
The value returned is in the range -1 to +1 about 70% of the time (see table below) and the distribution of values in this range is close to linear. The probability of a value occurring outside this range drops off quickly the farther you get from the origin.
Output Range | % result in this range |
-0.5 to +0.5 | about 40% |
-1.0 to +1.0 | about 70% |
-1.5 to +1.5 | about 86% |
-2.0 to +2.0 | about 96% |
-3.0 to +3.0 | >99% |
-5.0 to +5.0 | 100% |
-infinity to 0.0 | 50% |
0.0 to +infinity | 50% |
In theory, this routine could occasionally generate very large positive or negative values but in fact, no numbers outside the range -5 to +5 are generated.
AIAPI ai::int32(* AIRandomBellCurveSuite::GetRndSeedBellCurve)(void) |
Retrieves the current random-number seed.
The initial seed is based on the current date and time.
(Note that this function returns a numeric value, not an error code.)
AIRandomSuite::GetRndSeed()
AIAPI void(* AIRandomBellCurveSuite::SetRndSeedBellCurve)(ai::int32 seed) |
Sets the random number seed used to generate subsequent random numbers.
Use to restart a sequence of random numbers, for example for debugging. See AIRandomSuite::GetRndSeed()
for an example.
(Note that this function does not return an error code.)
The | new seed number, or 0 to set to an initial seed based on the current date and time. |
Contents | Suites | Classes | Class Index | Member Index |
![]() |
|