<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from distfun_seedset.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="distfun_seedset" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>distfun_seedset</refname>
    <refpurpose>Set the current state of the current random number generator</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   distfun_seedset(s)
   distfun_seedset(s1)
   distfun_seedset(s1,s2)
   distfun_seedset(s1,s2,s3,s4)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>s:</term>
      <listitem><para> a m-by-1 matrix of doubles, integer value, the state of the current random number generator</para></listitem></varlistentry>
   <varlistentry><term>s1,s2,s3,s4:</term>
      <listitem><para> a 1-by-1 matrix of doubles, integer value, the state 1, 2, 3 or 4 of the current random number generator</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Depending on the current random number generator, the distfun_seedset
function may accept different calling sequences.
   </para>
   <para>
<itemizedlist>
<listitem>
<para>"mt"</para>
<para>
A simple calling sequence is :
<screen>
distfun_seedset(s1)
</screen>
where s1 must be in [0,2^32[.
</para>
<para>
Another calling sequence is :
<screen>
distfun_seedset(s)
</screen>
where s is a 625-by-1 matrix of doubles, integer values.
The entry s(1) is an index and must be in [1,624],
the 624 last ones must be in [0,2^32[ (but must not be all zeros).
</para>
</listitem>
<listitem>
<para>
"kiss" :
</para>
<para>
The calling sequence is :
<screen>
distfun_seedset(s1,s2,s3,s4)
</screen>
where s1,s2,s3,s4 are four integers in [0,2^32[, or
<screen>
distfun_seedset(s)
</screen>
where s is a 4-by-1 matrix of doubles, integer value in [0,2^32[.
</para>
</listitem>
<listitem>
<para>
"clcg2"
</para>
<para>
The calling sequence is :
<screen>
distfun_seedset(s1,s2)
</screen>
where s1 and s2 are two integers, s1 in [1,2147483562] and s2 in [1,2147483398], or
<screen>
distfun_seedset(s)
</screen>
where s is a 2-by-1 matrix of doubles, integer value,
with s(1), s(2) as previously..
</para>
</listitem>
<listitem>
<para>"clcg4"</para>
<para>
The calling sequence is :
<screen>
distfun_seedset(s1,s2,s3,s4)
</screen>
where s1, s2, s3 and s4 are four integers with s1 in [1,2147483646],
s2 in [1,2147483542], s3 in [1,2147483422],
s4 in [1,2147483322], or
<screen>
distfun_seedset(s)
</screen>
where s is a 4-by-1 matrix of doubles, integer value,
with s(1), s(2), s(3) and s(4) as previously.
Sets the initial state of virtual generator with index g=0 to s1,s2,s3,s4.
The initial seeds of the other generators g=1,2,...,101 are automatically set
accordingly in order to be synchronised.
</para>
</listitem>
<listitem>
<para>"urand"</para>
<para>
The calling sequence is :
<screen>
distfun_seedset(s1)
</screen>
where s1 is one integer in [0,2^31[.
</para>
</listitem>
<listitem>
<para>"fsultra"</para>
<para>
A simple calling sequence is :
<screen>
distfun_seedset(s1,s2)
</screen>
where s1 and s2 are two integers in [0,2^32[, or
<screen>
distfun_seedset(s)
</screen>
where s is a 2-by-1 matrix of doubles, integer value,
with s(1), s(2) as previously.
</para>
<para>
The complete calling sequence is :
<screen>
distfun_seedset(s)
</screen>
where s is a vector of integers of dimension 40.
The first component s(1) is an index and
must be in [0,37], the 2d component s(2) is a flag (0 or 1),
the 3d component s(3) an integer in [1,2^32[
and the 37 others integers are in [0,2^32[.
</para>
</listitem>
<listitem>
<para>"crand"</para>
<para>
The calling sequence is :
<screen>
distfun_seedset(s1)
</screen>
where s1 is one integer in [0,2^15[.
</para>
</listitem>
</itemizedlist>
   </para>
   <para>
If the arguments s, s1, s2, s3 or s4 have a fractional part (i.e. do not
have an integer value), or if there are not in the range of
possible values, then an error is generated.
   </para>
   <para>
Setting the seed may be useful to get reproductible
or less reproductible random numbers.
   </para>
   <para>
The pseudo random number generators are based on deterministic sequences.
In order to get reproducible simulations, when we start Scilab, the initial seed of the
generator is constant, such that the sequence will remain the same from a session
to the other.
Hence, by default, the first numbers produced by distfun are always the same.
   </para>
   <para>
In some situations, we may want to initialize the seed of the generator in order
to produce less predictible numbers.
In this case, we may initialize the seed with the output of the getdate function:
   </para>
   <para>
<screen>
n=getdate("s");
distfun_seedset(n);
</screen>
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
distfun_seedset(1)
distfun_normrnd(12,7,5,3)
// Set the seed to the same value...
distfun_seedset(1)
// ... we get the same output :
distfun_normrnd(12,7,5,3)

   ]]></programlisting>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Copyright (C) 2012 - Michael Baudin</member>
   <member>Copyright (C) Jean-Philippe Chancelier and Bruno Pincon</member>
   </simplelist>
</refsection>
</refentry>
