Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,8 +0,0 @@
with Interfaces; use Interfaces;
package Random_Splitmix64 is
function next_Int return Unsigned_64;
function next_float return Float;
procedure Set_State (Seed : in Unsigned_64);
end Random_Splitmix64;

View file

@ -1,36 +0,0 @@
package body Random_Splitmix64 is
Internal : Unsigned_64 := 1234567;
--------------
-- next_Int --
--------------
function next_Int return Unsigned_64 is
Z : Unsigned_64;
begin
Internal := Internal + 16#9e3779b97f4a7c15#;
Z := Internal;
Z := (Z xor Shift_Right(Z, 30)) * 16#bf58476d1ce4e5b9#;
Z := (Z xor Shift_Right(Z, 27)) * 16#94d049bb133111eb#;
return Z xor Shift_Right(Z, 31);
end next_Int;
----------------
-- next_float --
----------------
function next_float return Float is
begin
return float(next_int) / (2.0 ** 64);
end next_float;
---------------
-- Set_State --
---------------
procedure Set_State (Seed : in Unsigned_64) is
begin
Internal := Seed;
end Set_State;
end Random_Splitmix64;

View file

@ -1,30 +0,0 @@
with Interfaces; use Interfaces;
with Random_Splitmix64; use Random_Splitmix64;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
subtype idx is Integer range 0 .. 4;
type answer_arr is array (idx) of Natural;
Vec : answer_arr := (others => 0);
J : Integer;
fj : Float;
begin
Set_State (1_234_567);
for I in 1 .. 5 loop
Put (Unsigned_64'Image (next_Int));
New_Line;
end loop;
Set_State (987_654_321);
for I in 1 .. 100_000 loop
fj := Float'Truncation (next_float * 5.0);
J := Integer (fj);
Vec (J) := Vec (J) + 1;
end loop;
for I in Vec'Range loop
Put_Line (I'Image & ":" & Integer'Image (Vec (I)));
end loop;
end Main;