<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="duserrnd">
  <refmeta>
    <refentrytitle>duserrnd</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>duserrnd</refname>
    <refpurpose>
      Discrete USER-defined-distribution RaNDom generator.
      <indexterm id="IndexDuserrnd"><primary>duserrnd</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      Discrete USER-defined-distribution RaNDom generator.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>aout <command>duserrnd</command> ktableNum</synopsis>

    <synopsis>iout <command>duserrnd</command> itableNum</synopsis>

    <synopsis>kout <command>duserrnd</command> ktableNum</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>itableNum</emphasis> -- number of table containing the random-distribution function.  Such table is generated by the user. See <link linkend="GEN40">GEN40</link>, <link linkend="GEN41">GEN41</link>, and <link linkend="GEN42">GEN42</link>. The table length does not need to be a power of 2
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>ktableNum</emphasis> -- number of table containing the random-distribution function.  Such table is generated by the user. See <link linkend="GEN40">GEN40</link>, <link linkend="GEN41">GEN41</link>, and <link linkend="GEN42">GEN42</link>. The table length does not need to be a power of 2
    </para>

    <para>
      <emphasis>duserrnd</emphasis> (discrete user-defined-distribution random generator) generates random values according to a discrete random distribution created by the user. The user can create the discrete distribution histogram by using <link linkend="GEN41">GEN41</link>. In order to create that table, the user has to define an arbitrary amount of number pairs, the first number of each pair representing a value and the second representing its probability (see <link linkend="GEN41">GEN41</link> for more details).  
    </para>

    <para>
      When used  as a function, the rate of generation depends by the rate type of input variable XtableNum. In this case it can be embedded into any formula. Table number can be varied at k-rate, allowing to change the distribution histogram during the performance of a single note. <emphasis>duserrnd</emphasis> is designed be used in algorithmic music generation.
    </para>

    <para>
      <emphasis>duserrnd</emphasis> can also be used to generate values following a set of ranges of probabilities by using distribution functions generated by GEN42 (See <link linkend="GEN42">GEN42</link> for more details). In this case, in order to simulate continuous ranges, the length of table XtableNum should be reasonably big, as <emphasis>duserrnd</emphasis> does not interpolate between table elements.
    </para>

    <para>
      For a tutorial about random distribution histograms and functions see:

      <itemizedlist>
        <listitem>
          <para>
            D. Lorrain. "A panoply of stochastic cannons". In C. Roads, ed. 1989. Music machine. Cambridge, Massachusetts: MIT press, pp. 351 - 379.
          </para>
        </listitem>
      </itemizedlist>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="cuserrnd"><citetitle>cuserrnd</citetitle></link>,
      <link linkend="urd"><citetitle>urd</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Author: &namegabriel;</para>
    <para>New in Version 4.16</para>
  </refsect1>
</refentry>
