Generic package: Ada.Numerics.Discrete_Random

Dependencies

with Interfaces;

Description

Note: the implementation used in this package was contributed by Robert Eachus. It is based on the work of L. Blum, M. Blum, and M. Shub, SIAM Journal of Computing, Vol 15. No 2, May 1986. The particular choices for P and Q chosen here guarantee a period of 562,085,314,430,582 (about 2**49), and the generated sequence has excellent randomness properties. For further details, see the paper "Fast Generation of Trustworthy Random Numbers", by Robert Eachus, which describes both the algorithm and the efficient implementation approach used here. This paper is available at the Ada Core Technologies web site (http://www.gnat.com). Basic facilities.

Header

generic
   type Result_Subtype is (<>);

package Ada.Numerics.Discrete_Random is
 

Type Summary

Generator (limited type)
Primitive Operations:  Random, Reset, Reset, Reset, Save
State
Primitive Operations:  Image, Reset, Save, Value

Constants and Named Numbers

Max_Image_Width : constant := 80;

Other Items:

type Generator is limited private;

function Random (Gen : Generator) return Result_Subtype;

procedure Reset (Gen : Generator);

procedure Reset (Gen : Generator; Initiator : Integer);
Advanced facilities.

type State is private;

procedure Save  (Gen : Generator; To_State   : out State);

procedure Reset (Gen : Generator; From_State : State);

function Image (Of_State    : State)  return String;

function Value (Coded_State : String) return State;

private

   --  Implementation-defined ...
end Ada.Numerics.Discrete_Random;