1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<title>MATH_Rand*</title> 9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 10</head> 11 12<body> 13 14<h1 align="left">MATH_Rand* <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1> 15<H2>Syntax</H2> 16 17<dl> 18 <dd> 19 <PRE><CODE>#include <nitro/math/rand.h> 20 21static inline u16 MATH_Rand16( <A href="MATHRandContext.html">MATHRandContext16</A> *context, u16 max );<BR></CODE></PRE> 22 <PRE><CODE>static inline u32 MATH_Rand32( <A href="MATHRandContext.html">MATHRandContext32</A> *context, u32 max ); 23</CODE></PRE> 24 </dd> 25</dl><h2>Arguments</h2> 26 27<table border="1" width="100%"> 28 29 30 31 <TR> 32 <TD width="176"><em><strong><font face="Courier New">context</font></strong></em></TD> 33 <TD width="670">Pointer to the context of the random number</TD> 34 </TR> 35 <TR> 36 <TD><em><strong><font face="Courier New">max</font></strong></em></TD> 37 <TD>Sets a maximum value for the random number being gotten. With this setting, the largest random number will be <nobr><code>max - 1</code></nobr>. If <code>0</code> is set here, the entire range of numbers can be gotten.</TD> 38 </TR> 39 </table> 40<h2>Return Values</h2> 41<p>A 16-bit random value for the <CODE>MATH_Rand16</CODE> function and a 32-bit random value for the <CODE>MATH_Rand32</CODE> function.</p> 42<H2>Description</H2> 43<P>This function gets a random number generated using the linear congruential method.</P> 44<P>This is an inline function, so you can optimize the code and reduce waste by setting a constant in the <em><strong><code>max</code></strong></em> argument.</P> 45<h2>See Also</h2> 46<P><a href="MATHRandContext.html"><code>MATHRandContext*</code></a>, <a href="MATH_InitRand.html"><code>MATH_InitRand*</code></a></P> 47<H2>Revision History</H2> 48<P>2004/12/13 Initial version.</P> 49<hr><p>CONFIDENTIAL</p></body> 50</html> 51