Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0013/irand.mac
There are 2 other files named irand.mac in the archive. Click here to see a list.
	TITLE	IRAND INTEGER RANDOM NUMBER
	SUBTTL	V.001  R.S.TOMLINSON 19 AUG 68
	ENTRY	IRAND
	INTERN	IRAND
	EXTERN	RAND

; GET RANDOM INTEGER UNIFORMLY DISTRIBUTED BETWEEN TWO LIMITS
; CALL:	JSA 16,IRAND
;	ARG 00,<LOWER LIMIT>
;	ARG 00,<UPPER LIMIT>
;	RESULT IN AC 0
; Modified to PUSHJ/POPJ calling convention 11 Oct 1980
; by Paul T. Robinson, Wesleyan Univ. for DECUS conversion to DEC-20
; call:	movei	16,[exp <lower limit>
;		    exp <upper limit>]
;	pushj	17,irand
;	result in ac0

IRAND:	pushj	17,rand
	LSH 0,-1
	MOVE 1,@1(16)
	SUB 1,@0(16)
	AOS 1
	MUL 0,1
	ADD 0,@0(16)
	popj	17,

	END