<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="_c74_vig.xsl" type="text/xsl"?>
<vignette name="The Rx256 Object" package="Max" rankfactor="2">
  <h1>The Rx256 Object</h1>
  <p>
Rx256 exposes the Xoxhiro256+ random number generator to Javascript (Xoshiro is a mash-up of XOR + Shift + Rotate). This random number generator is very efficient and has excellent statistical properties (a uniform distribution) for both integer and floating-point applications. You can also seed it for repeatable results.
</p>
  <h2>Constructor</h2>
  <code language="javascript">var xosh = new Rx256();
</code>
  <p>
Unlike Math::random, before you generate a random value with Xoshiro256+, you must create a new Rx256 object that will hold the state of the random number generator. Particularly if you want a repeatable sequence of numbers, it's important to have separate Rx256 objects to hold the state for each place you want to use a sequence of random values.
</p>
  <jsproperty_list name="Rx256">
    <jsproperty name="seed" get="0" set="1" type="nunber">
      <description>
            Set the seed to a non-zero value to generate a repeatable sequence of values. By default, the seed is 0, which uses the system clock to seed the random number generator.
        </description>
    </jsproperty>
 </jsproperty_list>
  <jsmethod_list name="Rx256">
    <jsmethod name="nextint">
        <arglist>
          <arg name="range" optional="0" type="number"/>
        </arglist>
      <description>
      Generate an integer value between 0 and range - 1. Example:
      <code language="javascript">
var xosh = new Rx256();
var num = xosh.nextint(25); // generate a random value between 0 and 24
      </code>
     </description>
    </jsmethod>
    <jsmethod name="nextfloat_bipolar">
      <description>
      Generate a floating-point value between -1 and 1. Example:
      <code language="javascript">
var xosh = new Rx256();
var num = xosh.nextfloat_bipolar(); // generate a random value -1 and 1
      </code>
    </description>
    </jsmethod>
    <jsmethod name="nextfloat_unipolar">
      <description>
          Generate a floating-point value between 0 and 1. Example:
          <code language="javascript">
    var xosh = new Rx256();
    var num = xosh.nextfloat_unipolar(); // generate a random value 0 and 1
          </code>
    </description>
    </jsmethod>
  </jsmethod_list>
</vignette>
