Imath
<navlinks>
<page>

# Rand32

    #include <Imath/ImathRandom.h>

The `Rand32` class is a fast pseudo-random number generator that generates a uniformly distributed sequence with a period length of \(2^32\).

class Rand32

  Fast random-number generator that generates a uniformly distributed sequence with a period length of 2^32.

  Public Functions

  inline Rand32(unsigned long int seed = 0)

    Constructor, given a seed.

  inline void init(unsigned long int seed)

    Re-initialize with a given seed.

  inline bool nextb()

    Get the next value in the sequence (range: [false, true]).

  inline unsigned long int nexti()

    Get the next value in the sequence (range: [0 … 0xffffffff]).

  float nextf()

    Get the next value in the sequence (range: [0 … 1[).

  inline float nextf(float rangeMin, float rangeMax)

    Get the next value in the sequence (range [rangeMin … rangeMax[).

</page>