Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Loops-Break/Dc/loops-break.dc
Normal file
25
Task/Loops-Break/Dc/loops-break.dc
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
1 ss [s = seed of the random number generator]sz
|
||||
0k [scale = 0]sz
|
||||
|
||||
[Function r: Push a random number from 0 to 20.]sz
|
||||
[
|
||||
[2Q]SA
|
||||
[
|
||||
[Formula (from POSIX) for random numbers of low quality.]sz
|
||||
ls 1103515245 * 12345 + 4294967296 % d ss [Compute next s]sz
|
||||
65536 / [it = s / 65536]sz
|
||||
d 16 !>A [Break loop if 16 <= it]sz
|
||||
sz 0 0 =B [Forget it, continue loop]sz
|
||||
]SB 0 0 =B
|
||||
20 % [Push it % 20]sz
|
||||
LA sz LB sz [Restore A, B]sz
|
||||
]sr
|
||||
|
||||
|
||||
[2Q]sA
|
||||
[
|
||||
0 0 =r p [Print 1st number.]sz
|
||||
10 =A [Break if 10 == it.]sz
|
||||
0 0 =r p sz [Print 2nd number.]sz
|
||||
0 0 =B [Continue loop.]sz
|
||||
]sB 0 0 =B
|
||||
Loading…
Add table
Add a link
Reference in a new issue