Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_30.ADF » P/+Rand1

P/+Rand1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_30.ADF
Filename: P/+Rand1
Read OK:
File size: 0338 bytes
Load address: 2B206576
Exec address: 646E6152
File contents
                                        Cardiff
                                         10 January 1997

Dear Gus

Random Numbers

Followint recent discussions about random numbers I have found the
following few lines of BASIC quite useful in generating random numbers
and/or Lottery type sequences. It appears fairly random without using the
X=RND(-TIME) finction.

10 DIM N%(49)
20 CLS
30 FOR I%= 1 TO 49
40 N%(I%)=I%
50 NEXT
60 FOR I%= 49 TO 2 STEP -1
70 C%= RND(I%)
80 T%=N%(C%)
90 N%(C%)=N%(I%)
100 N%(I%)=T%
110 NEXT
120:
130 FOR I%=1 TO 6
140 PRINT N%(I%)
150 NEXT

Z88 TRANSFERS

Dave Holden of APDL, 39 Knighton Park Road, Sydenham, London. SE26 5RN
Tel. 0181-778-2659 <info@apdl.co.uk> holds various PD progs for both the
Z88 and the NC100 in his library.

Cheers and a belated Blwyddyn Newydd Dda

D E Williams

00000000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000020  20 20 20 20 20 20 20 20  43 61 72 64 69 66 66 0d  |        Cardiff.|
00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000050  20 20 20 20 20 20 20 20  20 31 30 20 4a 61 6e 75  |         10 Janu|
00000060  61 72 79 20 31 39 39 37  0d 0d 44 65 61 72 20 47  |ary 1997..Dear G|
00000070  75 73 0d 0d 52 61 6e 64  6f 6d 20 4e 75 6d 62 65  |us..Random Numbe|
00000080  72 73 0d 0d 46 6f 6c 6c  6f 77 69 6e 74 20 72 65  |rs..Followint re|
00000090  63 65 6e 74 20 64 69 73  63 75 73 73 69 6f 6e 73  |cent discussions|
000000a0  20 61 62 6f 75 74 20 72  61 6e 64 6f 6d 20 6e 75  | about random nu|
000000b0  6d 62 65 72 73 20 49 20  68 61 76 65 20 66 6f 75  |mbers I have fou|
000000c0  6e 64 20 74 68 65 0d 66  6f 6c 6c 6f 77 69 6e 67  |nd the.following|
000000d0  20 66 65 77 20 6c 69 6e  65 73 20 6f 66 20 42 41  | few lines of BA|
000000e0  53 49 43 20 71 75 69 74  65 20 75 73 65 66 75 6c  |SIC quite useful|
000000f0  20 69 6e 20 67 65 6e 65  72 61 74 69 6e 67 20 72  | in generating r|
00000100  61 6e 64 6f 6d 20 6e 75  6d 62 65 72 73 0d 61 6e  |andom numbers.an|
00000110  64 2f 6f 72 20 4c 6f 74  74 65 72 79 20 74 79 70  |d/or Lottery typ|
00000120  65 20 73 65 71 75 65 6e  63 65 73 2e 20 49 74 20  |e sequences. It |
00000130  61 70 70 65 61 72 73 20  66 61 69 72 6c 79 20 72  |appears fairly r|
00000140  61 6e 64 6f 6d 20 77 69  74 68 6f 75 74 20 75 73  |andom without us|
00000150  69 6e 67 20 74 68 65 0d  58 3d 52 4e 44 28 2d 54  |ing the.X=RND(-T|
00000160  49 4d 45 29 20 66 69 6e  63 74 69 6f 6e 2e 0d 0d  |IME) finction...|
00000170  31 30 20 44 49 4d 20 4e  25 28 34 39 29 0d 32 30  |10 DIM N%(49).20|
00000180  20 43 4c 53 0d 33 30 20  46 4f 52 20 49 25 3d 20  | CLS.30 FOR I%= |
00000190  31 20 54 4f 20 34 39 0d  34 30 20 4e 25 28 49 25  |1 TO 49.40 N%(I%|
000001a0  29 3d 49 25 0d 35 30 20  4e 45 58 54 0d 36 30 20  |)=I%.50 NEXT.60 |
000001b0  46 4f 52 20 49 25 3d 20  34 39 20 54 4f 20 32 20  |FOR I%= 49 TO 2 |
000001c0  53 54 45 50 20 2d 31 0d  37 30 20 43 25 3d 20 52  |STEP -1.70 C%= R|
000001d0  4e 44 28 49 25 29 0d 38  30 20 54 25 3d 4e 25 28  |ND(I%).80 T%=N%(|
000001e0  43 25 29 0d 39 30 20 4e  25 28 43 25 29 3d 4e 25  |C%).90 N%(C%)=N%|
000001f0  28 49 25 29 0d 31 30 30  20 4e 25 28 49 25 29 3d  |(I%).100 N%(I%)=|
00000200  54 25 0d 31 31 30 20 4e  45 58 54 0d 31 32 30 3a  |T%.110 NEXT.120:|
00000210  0d 31 33 30 20 46 4f 52  20 49 25 3d 31 20 54 4f  |.130 FOR I%=1 TO|
00000220  20 36 0d 31 34 30 20 50  52 49 4e 54 20 4e 25 28  | 6.140 PRINT N%(|
00000230  49 25 29 0d 31 35 30 20  4e 45 58 54 0d 0d 5a 38  |I%).150 NEXT..Z8|
00000240  38 20 54 52 41 4e 53 46  45 52 53 0d 0d 44 61 76  |8 TRANSFERS..Dav|
00000250  65 20 48 6f 6c 64 65 6e  20 6f 66 20 41 50 44 4c  |e Holden of APDL|
00000260  2c 20 33 39 20 4b 6e 69  67 68 74 6f 6e 20 50 61  |, 39 Knighton Pa|
00000270  72 6b 20 52 6f 61 64 2c  20 53 79 64 65 6e 68 61  |rk Road, Sydenha|
00000280  6d 2c 20 4c 6f 6e 64 6f  6e 2e 20 53 45 32 36 20  |m, London. SE26 |
00000290  35 52 4e 0d 54 65 6c 2e  20 30 31 38 31 2d 37 37  |5RN.Tel. 0181-77|
000002a0  38 2d 32 36 35 39 20 3c  69 6e 66 6f 40 61 70 64  |8-2659 <info@apd|
000002b0  6c 2e 63 6f 2e 75 6b 3e  20 68 6f 6c 64 73 20 76  |l.co.uk> holds v|
000002c0  61 72 69 6f 75 73 20 50  44 20 70 72 6f 67 73 20  |arious PD progs |
000002d0  66 6f 72 20 62 6f 74 68  20 74 68 65 0d 5a 38 38  |for both the.Z88|
000002e0  20 61 6e 64 20 74 68 65  20 4e 43 31 30 30 20 69  | and the NC100 i|
000002f0  6e 20 68 69 73 20 6c 69  62 72 61 72 79 2e 0d 0d  |n his library...|
00000300  43 68 65 65 72 73 20 61  6e 64 20 61 20 62 65 6c  |Cheers and a bel|
00000310  61 74 65 64 20 42 6c 77  79 64 64 79 6e 20 4e 65  |ated Blwyddyn Ne|
00000320  77 79 64 64 20 44 64 61  0d 0d 44 20 45 20 57 69  |wydd Dda..D E Wi|
00000330  6c 6c 69 61 6d 73 0d 0d                           |lliams..|
00000338
P/+Rand1.m0
P/+Rand1.m1
P/+Rand1.m2
P/+Rand1.m4
P/+Rand1.m5