newLISP Fan Club

Forum => newLISP in the real world => Topic started by: joejoe on October 01, 2009, 10:49:43 AM

Title: randomize only randomizing once --- SOLVED, thanks!
Post by: joejoe on October 01, 2009, 10:49:43 AM
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:


#/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:


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)   --
Title:
Post by: newdep on October 01, 2009, 10:50:54 AM
Keep youre eyes on the 'seed's his sister said when they walked through the forest...
Title:
Post by: joejoe on October 01, 2009, 11:09:42 AM
Quote from: "newdep"Keep youre eyes on the 'seed's his sister said when they walked through the forest...


Got it!! Thanks newdep!!! :D


#/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)