------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUNTIME COMPONENTS                          --
--                                                                          --
--         A D A . N U M E R I C S . D I S C R E T E _ R A N D O M          --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--                            $Revision: 1.5 $                              --
--                                                                          --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT.  In accordance with the copyright of that document, you can freely --
-- copy and modify this specification,  provided that if you redistribute a --
-- modified version,  any changes that you have made are clearly indicated. --
--                                                                          --
------------------------------------------------------------------------------

with Ada.Finalization; use Ada.Finalization;
with Ada.Numerics.Random;

generic
   type Result_Subtype is (<>);

package Ada.Numerics.Discrete_Random is

   --  Basic facilities

   type Generator is limited private;

   function Random (Gen : Generator) return Result_Subtype;

   procedure Reset (Gen : in Generator);
   procedure Reset (Gen : in Generator; Initiator : in Integer);

   --  Advanced facilities

   type State is private;

   procedure Save  (Gen : in  Generator; To_State   : out State);
   procedure Reset (Gen : in  Generator; From_State : in  State);

   Max_Image_Width : constant := Ada.Numerics.Random.Max_Image_Width;

   function Image (Of_State    : State)  return String;
   function Value (Coded_State : String) return State;

private

   package ANR renames Ada.Numerics.Random;

   type State is new ANR.State;

   type Access_State is access ANR.State;

   type Generator is
      new Ada.Finalization.Limited_Controlled with record
         State : Access_State := new ANR.State'(ANR.Make_State);
      end record;

   procedure Finalize (Gen : in out Generator);

end Ada.Numerics.Discrete_Random;
