Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Loops-Break/Bc/loops-break.bc
Normal file
23
Task/Loops-Break/Bc/loops-break.bc
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
s = 1 /* seed of the random number generator */
|
||||
scale = 0
|
||||
|
||||
/* Random number from 0 to 20. */
|
||||
define r() {
|
||||
auto a
|
||||
while (1) {
|
||||
/* Formula (from POSIX) for random numbers of low quality. */
|
||||
s = (s * 1103515245 + 12345) % 4294967296
|
||||
a = s / 65536 /* a in [0, 65536) */
|
||||
if (a >= 16) break /* want a >= 65536 % 20 */
|
||||
}
|
||||
return (a % 20)
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
n = r()
|
||||
n /* print 1st number */
|
||||
if (n == 10) break
|
||||
r() /* print 2nd number */
|
||||
}
|
||||
quit
|
||||
Loading…
Add table
Add a link
Reference in a new issue