Adobe.com
Contents Suites Classes Class Index Member Index

AIRandomSuite Struct Reference
[API Suite List]

Together with the AIRandomBellCurveSuite, this suite allows you to add a degree of randomness, or "noise" to an effect. More...

#include <AIRandom.h>

List of all members.

Public Attributes

AIAPI AIReal(* FloatRnd )(void)
 Gets a random number in the range [0.0..1.0].
AIAPI void(* SetRndSeed )(ai::int32 seed)
 Sets the random number seed used to generate subsequent random numbers.
AIAPI ai::int32(* GetRndSeed )(void)
 Retrieves the current random-number seed.

Detailed Description

Together with the AIRandomBellCurveSuite, this suite allows you to add a degree of randomness, or "noise" to an effect.

This suite provides an even distribution of random numbers (as opposed to numbers distributed along a standard probability curve).


Member Data Documentation

Gets a random number in the range [0.0..1.0].

(Note that this function returns a numeric value, not an error code.)

Returns:
The random number.

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.)

Returns:
The random seed.

To restart a random number sequence, get and save the seed, generate the random numbers, then reset the seed with SetRndSeed() and generate the sequence again. For example, these two random loops generate the same sequence:

AIReal r;
short i;
long seed = sRandom->GetRndSeed();
for ( i = 0; i < 10; ++i ) {
        r = sRandom->FloatRnd();
}
sRandom->SetRndSeed( seed );
for ( i = 0; i < 10; ++i ) {
        r = sRandom->FloatRnd();
}
AIAPI void(* AIRandomSuite::SetRndSeed)(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 GetRndSeed() for an example.
(Note that this function does not return an error code.)

Parameters:
The new seed number, or 0 to set to an initial seed based on the current date and time.

The documentation for this struct was generated from the following file:


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2016 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks