Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/random.uti
There are 2 other files named random.uti in the archive. Click here to see a list.
1000' NAME--RANDOM
1010'
1020' DESCRIPTION--A SUBROUTINE WHICH RANDIMLY ORDERS THE
1030' INTEGERS FROM 1 TO N, AND STORES THEM IN A VECTOR.
1040'
1050' SOURCE--UNKNOWN
1060'
1070' INSTRUCTIONS--THE ROUTINE USES THE VARIABLE N TO SPECIFY THE
1080' LENGTH OF THE SEQUENCE. TO USE SOME OTHER VARIABLE CHANGE
1090' THE LET STATEMENT IN LINE 1160 . THE LIST P( ) IS USED
1100' TO STORE THE RANDOM SEQUENCE. THE OTHER VARIABLES USED ARE
1110' Z4,Z5,Z6,Z7,AND Z8.
1120'
1130'
1140' * * * * * * * * MAIN PROGRAM * * * * * * * * *
1150'
1160 LET Z4 = N
1170 MAT P=ZER
1180 FOR Z5 = 1 TO Z4
1190 LET Z6 = INT( (Z4+1-Z5)*RND ) + 1
1200 LET Z7 = 0
1210 FOR Z8 = 1 TO Z4
1220 IF P(Z8) <> 0 THEN 1260
1230 LET Z7 = Z7 + 1
1240 IF Z7 <> Z6 THEN 1260
1250 LET P(Z8) = Z5
1260 NEXT Z8
1270 NEXT Z5
1280 RETURN