raw
ffa_ch8_randomism.kv    1 ------------------------------------------------------------------------------
ffa_ch8_randomism.kv 2 ------------------------------------------------------------------------------
ffa_ch8_randomism.kv 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch8_randomism.kv 4 -- --
ffa_ch8_randomism.kv 5 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch8_randomism.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch8_randomism.kv 7 -- --
ffa_ch8_randomism.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch8_randomism.kv 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch8_randomism.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch8_randomism.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch8_randomism.kv 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch8_randomism.kv 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch8_randomism.kv 14 -- that you use - for any purpose. --
ffa_ch8_randomism.kv 15 -- --
ffa_ch8_randomism.kv 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch8_randomism.kv 17 ------------------------------------------------------------------------------
ffa_ch8_randomism.kv 18 ------------------------------------------------------------------------------
ffa_ch8_randomism.kv 19
ffa_ch8_randomism.kv 20 with Ada.Sequential_IO;
ffa_ch8_randomism.kv 21
ffa_ch8_randomism.kv 22 with Words; use Words;
ffa_ch8_randomism.kv 23 with FZ_Type; use FZ_Type;
ffa_ch8_randomism.kv 24
ffa_ch8_randomism.kv 25
ffa_ch8_randomism.kv 26 package FFA_RNG is
ffa_ch8_randomism.kv 27
ffa_ch8_randomism.kv 28 Default_RNG_Path : constant String := "/dev/random";
ffa_ch8_randomism.kv 29
ffa_ch8_randomism.kv 30 -- For reading from RNGs:
ffa_ch8_randomism.kv 31 package Word_IO is new Ada.Sequential_IO(Element_Type => Word);
ffa_ch8_randomism.kv 32
ffa_ch8_randomism.kv 33 -- Represents an RNG Device:
ffa_ch8_randomism.kv 34 type RNG_Device is record
ffa_ch8_randomism.kv 35 F : Word_IO.File_Type;
ffa_ch8_randomism.kv 36 end record;
ffa_ch8_randomism.kv 37
ffa_ch8_randomism.kv 38 -- Prepare an RNG for use; at given path, or will use default
ffa_ch8_randomism.kv 39 procedure Init_RNG(RNG : out RNG_Device;
ffa_ch8_randomism.kv 40 RNG_Unix_Path : in String := Default_RNG_Path);
ffa_ch8_randomism.kv 41
ffa_ch8_randomism.kv 42 -- Fill a FZ from RNG
ffa_ch8_randomism.kv 43 procedure FZ_Random(RNG : in RNG_Device;
ffa_ch8_randomism.kv 44 N : out FZ);
ffa_ch8_randomism.kv 45
ffa_ch8_randomism.kv 46 end FFA_RNG;