Jump to content

Different seeds in a loop expression


Recommended Posts

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

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy