<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>rand</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="rand"> random number generator</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>rand(m1,m2,.. [,key])  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>rand(x [, key])  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>rand()  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>rand(key)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>rand(&quot;seed&quot; [,n])  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>rand(&quot;info&quot;)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>mi</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: integers</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>key</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: character string with value in <VERB>&quot;uniform&quot;</VERB>, <VERB>&quot;normal&quot;</VERB></SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>x</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a matrix. Only its dimensions are taken into account.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    random matrix generator.
  </P>
    <P>
    Without key argument the syntaxes below produce  random matrices with
    the current random generator (default is &quot;uniform&quot;)
  </P>
    <DESCRIPTION_INDENT>
      <DESCRIPTION_ITEM label="rand(m1,m2)">
        <SP> is a random matrix of dimension <VERB>m1</VERB> by <VERB>m2</VERB>.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="rand(m1,m2,..,mn)">
        <SP> is a random matrix of dimension <VERB>m1</VERB> by <VERB>m2</VERB>,.. by <VERB>mn</VERB>.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="rand(a)">
        <SP> is a random matrix of same size as a. <VERB>rand(a)</VERB> is complex if  <VERB>a</VERB> is a complex matrix.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="rand() : with no arguments gives a scalar whose value changes">
        <SP> each time it is referenced.</SP>
      </DESCRIPTION_ITEM>
    </DESCRIPTION_INDENT>
    <P>
    If present, the key argument allows to specifie an other random distribution.
  </P>
    <DESCRIPTION_INDENT>
      <DESCRIPTION_ITEM label="rand('uniform')">
        <SP> The current random generator is set to a uniform random generator. Random numbers are 
            uniformly distributed in the interval (0,1).</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="rand('normal')">
        <SP> The current random generator is set to a Gaussian (with mean 0 and variance 1) random number generator.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="str=rand('info')">
        <SP> return the type of the default random generator ('uniform' or 'normal')</SP>
      </DESCRIPTION_ITEM>
    </DESCRIPTION_INDENT>
    <P>
    IT is possible to (re-)initialize the seed of the rand generator:
  </P>
    <DESCRIPTION_INDENT>
      <DESCRIPTION_ITEM label="rand('seed')">
        <SP> returns the current value of the seed.</SP>
      </DESCRIPTION_ITEM>
      <DESCRIPTION_ITEM label="rand('seed',n)">
        <SP> puts the seed to <VERB>n</VERB>. (by default <VERB>n=0</VERB> at first call).</SP>
      </DESCRIPTION_ITEM>
    </DESCRIPTION_INDENT>
  </DESCRIPTION>

    <SECTION label="Remark">
    <P>
       Use the more powerful function <LINK>grand</LINK> instead.
    </P>
    </SECTION>

  <EXAMPLE>
<![CDATA[
x=rand(10,10,'uniform')
rand('normal')
rand('info')
y=rand(x,'normal');
x=rand(2,2,2)
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>grand</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>ssrand</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
