------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- -- -- -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) -- -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html -- -- -- -- You do not have, nor can you ever acquire the right to use, copy or -- -- distribute this software ; Should you use this software for any purpose, -- -- or copy and distribute it to anyone or in any manner, you are breaking -- -- the laws of whatever soi-disant jurisdiction, and you promise to -- -- continue doing so for the indefinite future. In any case, please -- -- always : read and understand any software ; verify any PGP signatures -- -- that you use - for any purpose. -- -- -- -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with OS; use OS; with FZ_Type; use FZ_Type; package body FFA_RNG is -- Prepare an RNG for use; at given path, or will use default procedure Init_RNG(RNG : out RNG_Device; RNG_Unix_Path : in String := Default_RNG_Path) is begin begin -- Open the RNG at the offered path: Word_IO.Open(File => RNG.F, Mode => Word_IO.In_File, Name => RNG_Unix_Path); exception when others => Eggog("Could not open RNG at : " & RNG_Unix_Path & "!"); end; end Init_RNG; -- Fill a FZ from RNG procedure FZ_Random(RNG : in RNG_Device; N : out FZ) is begin begin -- Fill the destination FZ from this RNG: for i in N'Range loop Word_IO.Read(RNG.F, N(i)); end loop; exception when others => Eggog("Could not read from RNG!"); end; end FZ_Random; end FFA_RNG;