All pastes #458302 Raw Edit

Miscellany

public text v1 · immutable
#458302 ·published 2007-04-25 20:22 UTC
rendered paste body
with Ada.Calendar;
with Ada.Numerics.Discrete_Random;
procedure Random_Seed is
   Now : constant Ada.Calendar.Day_Seconds :=
     Ada.Calendar.Seconds (Ada.Calendar.Clock);
   use type Ada.Calendar.Day_Seconds;
   Seed : constant Integer := Integer (Now * 1000.0);
   
   type Random_Value is range 1 .. 10;
   package Random is new Ada.Numerics.Discrete_Random (Random_Value);
   Gen : Random.Genrator;
begin
   Random.Reset (Gen, Initiator => Seed);
end Random_Seed;