Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,16 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
type long is range 0 .. 2**64;
|
||||
Seed : long := 675_248;
|
||||
function random return long is
|
||||
begin
|
||||
Seed := Seed * Seed / 1_000 rem 1_000_000;
|
||||
return Seed;
|
||||
end random;
|
||||
begin
|
||||
for I in 1 .. 5 loop
|
||||
Put (long'Image (random));
|
||||
end loop;
|
||||
New_Line;
|
||||
end Main;
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. MIDDLE-SQUARE.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 STATE.
|
||||
03 SEED PIC 9(6) VALUE 675248.
|
||||
03 SQUARE PIC 9(12).
|
||||
03 FILLER REDEFINES SQUARE.
|
||||
05 FILLER PIC 9(3).
|
||||
05 NEXT-SEED PIC 9(6).
|
||||
05 FILLER PIC 9(3).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
BEGIN.
|
||||
PERFORM SHOW-NUM 5 TIMES.
|
||||
STOP RUN.
|
||||
|
||||
SHOW-NUM.
|
||||
PERFORM MAKE-RANDOM.
|
||||
DISPLAY SEED.
|
||||
|
||||
MAKE-RANDOM.
|
||||
MULTIPLY SEED BY SEED GIVING SQUARE.
|
||||
MOVE NEXT-SEED TO SEED.
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">seed</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">675248</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">random</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #000000;">seed</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #000000;">seed</span><span style="color: #0000FF;">*</span><span style="color: #000000;">seed</span><span style="color: #0000FF;">/</span><span style="color: #000000;">1000</span><span style="color: #0000FF;">),</span><span style="color: #000000;">1e6</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000080;font-style:italic;">-- seed = to_integer(sprintf("%012d",seed*seed)[4..9])</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">seed</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">5</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #0000FF;">?</span><span style="color: #000000;">random</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
with javascript_semantics
|
||||
integer seed = 675248
|
||||
function random()
|
||||
seed = remainder(floor(seed*seed/1000),1e6)
|
||||
-- seed = to_integer(sprintf("%012d",seed*seed)[4..9])
|
||||
return seed
|
||||
end function
|
||||
for i=1 to 5 do
|
||||
?random()
|
||||
end for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue