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

@ -8,7 +8,7 @@ L(n) 2..54
s.append((s[n - 2] - s[n - 1]) % 10 ^ 9)
Deque[Int] r
L(n) 55
L(n) 0.<55
V i = (34 * (n + 1)) % 55
r.append(s[i])

View file

@ -1,11 +0,0 @@
package Subtractive_Generator is
type State is private;
procedure Initialize (Generator : in out State; Seed : Natural);
procedure Next (Generator : in out State; N : out Natural);
private
type Number_Array is array (Natural range <>) of Natural;
type State is record
R : Number_Array (0 .. 54);
Last : Natural;
end record;
end Subtractive_Generator;

View file

@ -1,33 +0,0 @@
package body Subtractive_Generator is
procedure Initialize (Generator : in out State; Seed : Natural) is
S : Number_Array (0 .. 1);
I : Natural := 0;
J : Natural := 1;
begin
S (0) := Seed;
S (1) := 1;
Generator.R (54) := S (0);
Generator.R (33) := S (1);
for N in 2 .. Generator.R'Last loop
S (I) := (S (I) - S (J)) mod 10 ** 9;
Generator.R ((34 * N - 1) mod 55) := S (I);
I := (I + 1) mod 2;
J := (J + 1) mod 2;
end loop;
Generator.Last := 54;
for I in 1 .. 165 loop
Subtractive_Generator.Next (Generator => Generator, N => J);
end loop;
end Initialize;
procedure Next (Generator : in out State; N : out Natural) is
begin
Generator.Last := (Generator.Last + 1) mod 55;
Generator.R (Generator.Last) :=
(Generator.R (Generator.Last)
- Generator.R ((Generator.Last - 24) mod 55)) mod 10 ** 9;
N := Generator.R (Generator.Last);
end Next;
end Subtractive_Generator;

View file

@ -1,14 +0,0 @@
with Ada.Text_IO;
with Subtractive_Generator;
procedure Main is
Random : Subtractive_Generator.State;
N : Natural;
begin
Subtractive_Generator.Initialize (Generator => Random,
Seed => 292929);
for I in 220 .. 222 loop
Subtractive_Generator.Next (Generator => Random, N => N);
Ada.Text_IO.Put_Line (Integer'Image (I) & ":" & Integer'Image (N));
end loop;
end Main;

View file

@ -1,46 +0,0 @@
function Get-SubtractiveRandom ( [int]$Seed )
{
function Mod ( [int]$X, [int]$M = 1000000000 ) { ( $X % $M + $M ) % $M }
If ( $Seed )
{
$R = New-Object int[] 55
$N1 = 55 - 1
$N2 = ( $N1 + 34 ) % 55
$R[$N1] = $Seed
$R[$N2] = 1
ForEach ( $x in 2..(55-1) )
{
$N0, $N1, $N2 = $N1, $N2, ( ( $N2 + 34 ) % 55 )
$R[$N2] = Mod ( $R[$N0] - $R[$N1] )
}
$i = -55 - 1
$j = -24 - 1
ForEach ( $x in 55..219 )
{
$i = ++$i % 55
$j = ++$j % 55
$R[$i] = Mod ( $R[$i] - $R[$j] )
}
$Script:RandomRing = $R
$Script:RandomIndex = $i
}
$i = $Script:RandomIndex = ++$Script:RandomIndex % 55
$j = ( $i + 55 - 24 ) % 55
return ( $Script:RandomRing[$i] = Mod ( $Script:RandomRing[$i] - $Script:RandomRing[$j] ) )
}
Get-SubtractiveRandom 292929
Get-SubtractiveRandom
Get-SubtractiveRandom
Get-SubtractiveRandom
Get-SubtractiveRandom