Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50036/random.mac
There are 5 other files named random.mac in the archive. Click here to see a list.
TITLE RANDOM NUMBER GENERATOR
;CALLED BY CALL RANDOM(R), WHERE R IS RETURNED, -1.0<R>1.0
; OR BY A=RANDOM(R), EQUIVALENT TO CALL RANDOM(R), A = R
ENTRY RANDOM
RANDOM: Z
MOVEM 01, SAVAC1
MOVE 00, VAR
MUL 00, CONST
ASHC 00, 5
MOVEM 00, SIGN ;SAVE FOR SIGN BIT
SETZ 00,
ASHC 00, -5
MOVEM 01, VAR
ASHC 00, 40
TLC 00, 200000 ;FLOAT
MOVE 01, SIGN ;GET A SIGN BIT
TRNE 01, 1
MOVNS 00
FADR 00, NORM ;NORMALIZE
MOVEM 00, @0(16)
JRA 16, 1(16)
VAR: OCT 5343277245
CONST: OCT 5343277245
NORM: OCT 200000000000
SIGN: BLOCK 1
SAVAC1: BLOCK 1
END