#!/usr/bin/newlisp

# random - benchmark
#
# note, that newLISP has various fast built-in random 
# functions which are not used here
#

(set 'IM 139968)
(set 'IA 3877)
(set 'IC 29573)

(set 'LAST 42)

(define (gen_random maximum)
	(set 'LAST (mod (add (mul LAST IA) IC) IM))
	(div (mul maximum LAST) IM))
	

(define (main)
	(set 'N (integer (main-args 2)))
	(dotimes (i (- N 1)) (gen_random 100.0))
	
	(println (format "%.9f" (gen_random 100.0))) )
	
(main)
	
(exit)



syntax highlighting with newLISP and syntax.cgi