Page 1 of 1

randomize only randomizing once --- SOLVED, thanks!

Posted: Thu Oct 01, 2009 5:49 pm
by joejoe
Hi -

When I run my go.lsp file repeatedly from the command line, I am getting the same output every time. Here is the go.lsp:

Code: Select all

#/usr/bin/newlisp

; read the input file

(set 'l (read-file "./list"))

; parse and print the inputed, randomized file

(set 'r (randomize (parse l)))
(println r)

(exit)
$ newlisp go.lsp
("nine" "five" "one" "three" "ten" "six" "eight" "two" "four" "seven")
$ newlisp go.lsp
("nine" "five" "one" "three" "ten" "six" "eight" "two" "four" "seven")

The file list looks like this:

Code: Select all

one
two
three
four
five
six
seven
eight
nine
ten
I am trying to get it to display a different, randomized output every time.

Thanks for any hint. :0) --

Posted: Thu Oct 01, 2009 5:50 pm
by newdep
Keep youre eyes on the 'seed's his sister said when they walked through the forest...

Posted: Thu Oct 01, 2009 6:09 pm
by joejoe
newdep wrote:Keep youre eyes on the 'seed's his sister said when they walked through the forest...
Got it!! Thanks newdep!!! :D

Code: Select all

#/usr/bin/newlisp

; read the input file

(set 'l (read-file "./list"))

; parse and print the inputed, randomized file

(seed (date-value))
(set 'r (randomize (parse l)))
(println r)

(exit)