# MATHRandContext*

## Syntax

      #include <nitro/math/rand.h>

      typedef struct
      {
          u64  x ;
          u64  mul ;
          u64  add ;
      }
      MATHRandContext32;
      typedef struct
      {
          u32  x ;
          u32  mul ;
          u32  add ;
      }
      MATHRandContext16;

## Elements

x | The current random number value. The `MATH_Rand*` functions get a value shifted from this number.
mul | Stores the number that will be multiplied to get the next random number generated by the linear congruential method. This is initialized to a unique constant by the `MATH_InitRand*` functions, so if you change this value be sure to change this member afterward.
add | Stores the number that will be added to get the next random number generated by the linear congruential method. This is initialized to a unique constant by the `MATH_InitRand*` functions, so if you change this value be sure to change this member afterward.

## Description

The context structure of random number generated by linear congruential method.

`MATHRandContext32` internally stores a 64-bit value and the `MATH_Rand32` function gets a 32-bit random number. `MATHRandContext16` internally stores a 32-bit value and the `MATH_Rand16` function gets a 16-bit random number.

## See Also

`MATH_InitRand*`
`MATH_Rand*`

## Revision History

2004/12/13 Initial version.

CONFIDENTIAL