Open Search
    Random Class Reference

    #include <c4d_tools.h>

    Detailed Description

    A class to generate random number sequences.
    Uniform and Gaussian deviates can be generated.

    Public Member Functions

     Random ()
     
    void Init (UInt32 s)
     
    MAXON_ATTRIBUTE_FORCE_INLINE Float Get01 ()
     
    MAXON_ATTRIBUTE_FORCE_INLINE Float Get11 ()
     
    Float GetG01 ()
     
    Float GetG11 ()
     
    Int32 GetSeed () const
     

    Private Attributes

    UInt32 seed
     
    Int32 iset
     
    Float gset
     

    Constructor & Destructor Documentation

    ◆ Random()

    Random ( )

    Default constructor.

    Member Function Documentation

    ◆ Init()

    void Init ( UInt32  s)

    Initializes the random number sequence from a starting seed. Each seed will give a different sequence of random numbers.

    Parameters
    [in]sThe initial seed to start the random number sequence.

    ◆ Get01()

    Gets a random value between 0 and 1.

    Returns
    A random value in the range [0, 1].

    ◆ Get11()

    Gets a random value between -1 and +1.

    Returns
    A random value in the range [-1, +1].

    ◆ GetG01()

    Float GetG01 ( )

    Gets a random value between 0 and 1 with Gaussian distribution.

    Returns
    A random value in the range [0, 1] with Gaussian distribution.

    ◆ GetG11()

    Float GetG11 ( )

    Gets a random value between -1 and +1 with Gaussian distribution.

    Returns
    A random value in the range [-1, +1] with Gaussian distribution.

    ◆ GetSeed()

    Int32 GetSeed ( ) const

    Gets the seed representing the current state of the random number generator.

    Returns
    The current seed.

    Member Data Documentation

    ◆ seed

    UInt32 seed
    private

    ◆ iset

    Int32 iset
    private

    ◆ gset

    Float gset
    private