5 Cents for today..
5 Cents for today..
I posted some scripts again at http://nodep.nl/newlisp/index.html
If you like to see your PC work?! use the Latin Square script ;-)
Enjoy, Norman.
If you like to see your PC work?! use the Latin Square script ;-)
Enjoy, Norman.
-- (define? (Cornflakes))
Nice! ;-)
There is an interesting case:
Latin Square needs 'randomize' to return ALL possible variants of sequence, which means even the SAME sequence.
This case (and similar ones) will never get solved (infinite loop):
Lutz - could we get optional parameter in 'randomize'?
=> (randomize '(1 2 3) true) => '(1 2 3)
=> returns ALL possible variants, INCLUDING the SAME sequence
... I feel kinda stupid now, when I proved that randomize (or shuffle :-) will sometimes return the same sequence, than we repaired it and now I would like to have a parameter to return the same sequence again :-)))
Fanda
There is an interesting case:
Latin Square needs 'randomize' to return ALL possible variants of sequence, which means even the SAME sequence.
This case (and similar ones) will never get solved (infinite loop):
Code: Select all
--- Running!
(2 3 1)
(3 1 2)
=> (randomize '(1 2 3) true) => '(1 2 3)
=> returns ALL possible variants, INCLUDING the SAME sequence
... I feel kinda stupid now, when I proved that randomize (or shuffle :-) will sometimes return the same sequence, than we repaired it and now I would like to have a parameter to return the same sequence again :-)))
Fanda
Current 'randomize' never returns the same sequence (and you usually want this).
Try this test:
You shouldn't find '(1 2 3) in the result.
Fanda
Try this test:
Code: Select all
; TEST for randomize
(setq L '(1 2 3))
(setq r '())
(dotimes (x 10000)
(push (randomize L) r))
(setq r (unique r))
(println r)
(if (find L r)
(println "ERROR!")
(println "OK!"))
Fanda
This Unique random issue...Intresting because I have here a program that checks on UniqueNess inside my codebase and i failed so far ( that explains more then my assumption that the total of random occeurenances still had to come ;-)...
So when was this changed? (I like this unique option saves me some work..)
I first thought it was related to the 'Seed ..but its not..not even wehn you place a new 'seed inside the loop...Mmm funny that i did not notice this..
Happy that this was brought up...
By the way..it also fails on linux.. (correction on the above)
Regards, Norman.
So when was this changed? (I like this unique option saves me some work..)
I first thought it was related to the 'Seed ..but its not..not even wehn you place a new 'seed inside the loop...Mmm funny that i did not notice this..
Happy that this was brought up...
By the way..it also fails on linux.. (correction on the above)
Regards, Norman.
-- (define? (Cornflakes))
I am not sure, if I understand...
The only thing is: 'randomize' function without that optional 'true' will mix the output list as long as it is the same as the input list - you always get something different than you started with.
If you use optional 'true' (useful only in the next version of newLISP) you get all the cases possible - even the same list you started with.
Fanda
The only thing is: 'randomize' function without that optional 'true' will mix the output list as long as it is the same as the input list - you always get something different than you started with.
If you use optional 'true' (useful only in the next version of newLISP) you get all the cases possible - even the same list you started with.
Fanda
PS: My favorite game: http://www.planarity.net/