Pseudo-random numbers/Splitmix64: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 104:
=={{header|Ada}}==
The random number functions are written in a stand-alone package. The package is split into a package specification defining the interfaces to the public subprograms and a body containing the implementation of the random number generator.
Line 161 ⟶ 159:
procedure Main is
subtype idx is Integer range 0 .. 4;
type answer_arr is array (idx) of
Vec : answer_arr := (others => 0);
J :
fj : Float;
begin
Line 176 ⟶ 174:
for I in 1 .. 100_000 loop
fj := Float'Truncation (next_float * 5.0);
J :=
Vec (J) := Vec (J) + 1;
end loop;
for I in Vec'Range loop
Put_Line (I'Image & ":" &
end loop;
end Main;
</lang>
{{out}}
<pre>
Line 192 ⟶ 191:
4593380528125082431
16408922859458223821
0:
1:
2: 20073
3:
4:
</pre>
|