On Sun, 22 Dec 2002 18:38:33 GMT, Robert A Duff wrote: >I think you want the generator to be global to Generate_FileName. >Otherwise, it will be reinitialized each time Generate_FileName >is called. > >- Bob What do you mean? Can you give an example? Here is a working version: -------- with Ada.Text_IO, Ada.Numerics.Discrete_Random; use Ada.Text_IO; procedure Random_Test is valid_chars : String := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" & "0123456789!�$%&()=@+-;_#"; subtype Int_Slice is Integer range valid_chars'range; package My_Random is new Ada.Numerics.Discrete_Random (Int_Slice); function Generate_FileName (Length : Positive) return String is G : My_Random.Generator; I : Int_Slice; Result : String (1 .. Length); begin My_Random.Reset(G); for X in 1..Length loop I := My_Random.Random(G); Result(X) := valid_chars(I); end loop; return Result; end Generate_FileName; begin for X in 1..10 loop Put_Line(Generate_Filename(8)); end loop; end Random_Test; --------------- When I put subtype Int_Slice is Integer range valid_chars'range; package My_Random is new Ada.Numerics.Discrete_Random (Int_Slice); into the function, nothing changes. Thanks.