JulioHerrlein Posted May 19, 2021 Share Posted May 19, 2021 Dear All, How can I get controlled seeds in a expression like this? (let ((r-lis nil)) (dotimes (i 4) (push (rnd-unique 5 '(1 2 3 4 5)) r-lis)) r-lis) This will result four different seeds (one for each loop iteration), like this: rnd-unique :seed 361914 rnd-unique :seed 275956 rnd-unique :seed 883737 rnd-unique :seed 46981 ((3 1 4 5 2) (4 2 1 5 3) (2 5 4 1 3) (1 3 5 4 2)) And this will result the same seed for all four iterations: (let ((r-lis nil)) (dotimes (i 4) (push (rnd-unique 5 '(1 2 3 4 5):seed 1) r-lis)) r-lis) Like this: rnd-unique :seed 1 rnd-unique :seed 1 rnd-unique :seed 1 rnd-unique :seed 1 ((3 1 5 4 2) (3 1 5 4 2) (3 1 5 4 2) (3 1 5 4 2)) How to make it with a specific seed chosen for each loop iteration? THIS WON´T WORK... (let ((r-lis nil)) (dotimes (i 4) (push (rnd-unique 5 '(1 2 3 4 5):seed '(1 23 467 11)) r-lis)) r-lis) All the best ! Thank you ! Julio Quote Link to comment Share on other sites More sharing options...
opmo Posted May 19, 2021 Share Posted May 19, 2021 (let ((seed '(1 23 467 11))) (loop for i in seed collect (rnd-unique 5 '(1 2 3 4 5) :seed i)) ) JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted May 19, 2021 Author Share Posted May 19, 2021 Thanks, Janusz ! Best, Julio Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.