# AES_Rand

## Syntax

      #include <twl/aes.h>

      AESResult AES_Rand( void* p, u32 size );

## Arguments

p | Pointer to the buffer to which to write a random number.
size | Size of the buffer to which to write the random number.

## Return Values

Returns `AES_RESULT_SUCCESS` if the random number was generated successfully. Any other return values indicate an error.

## Description

Generates a pseudo-random number using the AES algorithm.

For the following reasons, this function is not well-suited for generating standard random numbers. It should only be used for special purposes.

- It is slow.
- Its random numbers are not reproducible.
- It cannot be used while AES operations that contain `AES_Rand()` are running.

Use the MATH Random Number Generator in order to generate standard random numbers.

## See Also

``

## Revision History

2007/12/25 Initial version.

CONFIDENTIAL