Page 1 of 1
5 Cents for today..
Posted: Mon Oct 10, 2005 1:07 pm
by newdep
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.
Posted: Mon Oct 10, 2005 1:52 pm
by Lutz
Beautiful the latin square, even the fan in my Mac Mini came on trying a 9-square ;), playing with this thing is addictive.
Lutz
Posted: Mon Oct 10, 2005 1:59 pm
by newdep
hehe..Its a load indeed... And im still running a Square 15..dont think that will finish today tough ;-)
Posted: Tue Oct 11, 2005 7:41 am
by Fanda
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
Posted: Tue Oct 11, 2005 7:52 am
by Fanda
ps: We could also vote if optional 'true' means ALL or (ALL except the SAME). If it's not too late...
Fanda
Posted: Tue Oct 11, 2005 10:51 am
by Lutz
let's go with 'true' for randomizing with repetition
Lutz
Posted: Tue Oct 11, 2005 12:08 pm
by newdep
So that means the current random functions are unique?
Cant we better change the 'seed behaviour instead?
Regards, Norman.
Posted: Tue Oct 11, 2005 12:22 pm
by newdep
Mmmm also intresting is that i dont have this (1 2 3) problem on my linux machine but i do have it on my windows XP machine....
???
Posted: Tue Oct 11, 2005 6:43 pm
by Fanda
Current 'randomize' never returns the same sequence (and you usually want this).
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!"))
You shouldn't find '(1 2 3) in the result.
Fanda
Posted: Tue Oct 11, 2005 6:53 pm
by newdep
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.
Posted: Wed Oct 12, 2005 7:09 am
by Fanda
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
Posted: Wed Oct 12, 2005 9:35 am
by newdep
Ah yes I overlooked this in the manual
-> randomize will always return a sequence different from the previous one.
Posted: Sat Oct 15, 2005 8:39 pm
by Fanda
Now, just add the 'true' to randomize functions :)
Fanda
Posted: Sat Oct 15, 2005 8:54 pm
by Lutz
The 'true' flag in 'randomize' is already there, see the manual ;)
Lutz
Posted: Sat Oct 15, 2005 8:57 pm
by Fanda
Posted: Sat Oct 15, 2005 9:51 pm
by newdep
Aaa nice... Lets have a look at it, seems intresting game ;-)
Yes the "true is in it ;-) Runs great now ;-) Thanks!