Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50053/setran.mac
There are 2 other files named setran.mac in the archive. Click here to see a list.
TITLE SETRAN SET RANDOM NUMBER SEED
SUBTTL V.001 R.S.TOMLINSON 19 AUG 68
ENTRY SETRAN
INTERN SETRAN
EXTERN RAND,RND,RND1
; SET RANDOM NUMBER SEED
; THIS ROUTINE SETS THE ORIGIN OF THE RANDOM NUMBER SEQUENCE AND
; IS USED IN CONJUNCTION WITH GETRAN TO ALLOW A "RANDOM" NUMBER
; SEQUENCE TO BE REPEATED.
; THE FIRST RANDOM NUMBER GENERATED AFTER A CALL TO GETRAN WILL BE
; THE SAME AS THE FIRST RANDOM NUMBER GENERATED AFTER A CALL TO SETRAN
; WITH THE SAME ARGUMENTS. THUS IN THE FOLLOWING PROGRAM:
; CALL GETRAN(I,J)
; X=RANDOM(1.0,2.0)
; CALL SETRAN(I,J)
; Y=RANDOM(1.0,2.0)
; X AND Y WILL BE SET TO THE SAME NUMBER.
; CALL: JSA 16,SETRAN
; ARG 00,<WHERE TO GET HIGH PART>
; ARG 00,<WHERE TO GET LOW PART>
; . . .
SETRAN: 0
MOVE 0,@0(16) ; GET HIGH ORDER PART
MOVEM 0,RND ; PUT IT IN RANDOM # SEED
MOVE 0,@1(16) ; GET LOW ORDER PART
IORI 0,1 ; FORCE NUMBER TO BE ODD
MOVEM 0,RND1 ; PUT IT IN RANDOM # SEED
JRA 16,2(16)
END