# MATHRandContext*

## C Specification

      #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*` function generates and assigns 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. The `MATH_InitRand*` function is initialized with unique constants, 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. The `MATH_InitRand*` function is initialized with unique constants, 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` stores a 64-bit value and a 32-bit random number generated by `MATH_Rand32`. `MATHRandContext16` stores a 32-bit value and a 16-bit random number generated by `MATH_Rand16`.

## See Also

`MATH_InitRand*`, `MATH_Rand*`

## Revision History

12/13/2004 Initial version.

CONFIDENTIAL