Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 1405

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>rand</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Mathematical functions"
HREF="ref.math.html"><LINK
REL="PREVIOUS"
TITLE="pow"
HREF="function.pow.html"><LINK
REL="NEXT"
TITLE="round"
HREF="function.round.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.pow.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.round.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.rand"
>rand</A
></H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN15972"
></A
>rand -- Generate a random value</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN15975"
></A
><H2
>Description</H2
><DIV
CLASS="funcsynopsis"
><P
></P
><CODE
CLASS="FUNCDEF"
>int rand</CODE
>(
      [<SPAN
CLASS="optional"
>int min</SPAN
>]
     , 
      [<SPAN
CLASS="optional"
>int max</SPAN
>]
     );<P
></P
></DIV
><P
>&#13;     If called without the optional <TT
CLASS="parameter"
><I
>min</I
></TT
>,
     <TT
CLASS="parameter"
><I
>max</I
></TT
> arguments <B
CLASS="function"
>rand()</B
>
     returns a pseudo-random value between 0 and
     <TT
CLASS="constant"
>RAND_MAX</TT
>.  If you want a random number
     between 5 and 15 (inclusive), for example, use <TT
CLASS="literal"
>rand (5,
     15)</TT
>.
    </P
><P
>&#13;     Remember to seed the random number generator before use with
     <A
HREF="function.srand.html"
><B
CLASS="function"
>srand()</B
></A
>.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      In versions before 3.0.7 the meaning of
      <TT
CLASS="parameter"
><I
>max</I
></TT
> was <TT
CLASS="parameter"
><I
>range</I
></TT
>. To
      get the same results in these versions the short example should
      be <TT
CLASS="literal"
>rand (5, 11)</TT
> to get a random number
      between 5 und 15.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     See also <A
HREF="function.srand.html"
><B
CLASS="function"
>srand()</B
></A
>,
     <A
HREF="function.getrandmax.html"
><B
CLASS="function"
>getrandmax()</B
></A
>, <A
HREF="function.mt-rand.html"
><B
CLASS="function"
>mt_rand()</B
></A
>,
     <A
HREF="function.mt-srand.html"
><B
CLASS="function"
>mt_srand()</B
></A
> and
     <A
HREF="function.mt-getrandmax.html"
><B
CLASS="function"
>mt_getrandmax()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.pow.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.round.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>pow</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.math.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>round</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>