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

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

<refentry version="5.0-subset Scilab" xml:id="distfun_unifrnd" 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_unifrnd</refname>
    <refpurpose>Uniform random numbers</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   x = distfun_unifrnd ( a , b )
   x = distfun_unifrnd ( a , b , [m,n] )
   x = distfun_unifrnd ( a , b , m , n )
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>a :</term>
      <listitem><para> a matrix of doubles, the lower bound</para></listitem></varlistentry>
   <varlistentry><term>b :</term>
      <listitem><para> a matrix of doubles, the upper bound (with a&lt;=b)</para></listitem></varlistentry>
   <varlistentry><term>m :</term>
      <listitem><para> a 1-by-1 matrix of floating point integers, the number of rows of x</para></listitem></varlistentry>
   <varlistentry><term>n :</term>
      <listitem><para> a 1-by-1 matrix of floating point integers, the number of columns of x</para></listitem></varlistentry>
   <varlistentry><term>x:</term>
      <listitem><para> a matrix of doubles, the random numbers in the interval [a,b].</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Generates random variables from the Uniform distribution function.
   </para>
   <para>
Any scalar input argument is expanded to a matrix of doubles
of the same size as the other input arguments.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Use x = distfun_unifrnd ( a , b )
x=distfun_unifrnd(1:6,2:7)
x=distfun_unifrnd(1:6,7)
x=distfun_unifrnd(1,2:7)

// Use x = distfun_unifrnd ( a , b , v )
x = distfun_unifrnd(2,3,[3 2])

// Check x = distfun_unifrnd ( a , b , m , n )
x = distfun_unifrnd([1 2 3;4 5 6],7,2,3)
x = distfun_unifrnd(4,5,2,3)
x = distfun_unifrnd(0,[1 2 3;4 5 6],2,3)

// Check mean and variance for x = distfun_unifrnd ( a , b )
N = 1000;
a = 1:6;
b = 2:7;
[M,V] = distfun_unifstat ( a , b )
for i = 1:N
computed(i,1:6) = distfun_unifrnd(a,b);
end
Mx = mean(computed, "r" )
Vx = variance(computed, "r" )

// Make a plot of the actual distribution of the numbers
a = 2;
b = 3;
scf();
x = distfun_unifrnd(a,b,1,1000);
histplot(10,x)
x = linspace(a-1,b+1,1000);
y = distfun_unifpdf(x,a,b);
plot(x,y)
xtitle("Uniform random numbers","X","Density");
legend(["Empirical","PDF"]);

   ]]></programlisting>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Copyright (C) 2012 - 2014 - Michael Baudin</member>
   </simplelist>
</refsection>
</refentry>
