PatrickMimran Posted May 30, 2017 Share Posted May 30, 2017 I try to put a seed as an option in this function with a default value of nil or no seed , how may i add it as optional Thanks Patrick (defun patkaos ( seed lambda long ) (let ((res (cons seed nil)) (xn seed)) (dotimes (n long res) (setf res (cons (setf xn (* lambda xn (- 1 xn))) res))) (reverse res))) Quote Link to comment Share on other sites More sharing options...
opmo Posted May 30, 2017 Share Posted May 30, 2017 Check the RND-SEED document. Quote Link to comment Share on other sites More sharing options...
PatrickMimran Posted May 30, 2017 Author Share Posted May 30, 2017 i looked at it and i tried to put it in the function , but without success This is what i did (defun patkaos ( lambda long &key seed ) (rnd-seed seed ) (let ((res (cons seed nil)) (xn seed)) (dotimes (n long res) (setf res (cons (setf xn (* lambda xn (- 1 xn))) res))) (reverse res))) when i evaluate this is what i gat Error: floating-point-overflow detected > performing * on (-2.5452163E+36 2.5452163E+36) > While executing: ccl::*-2, in process Listener-1(7). > Type cmd-. to abort, cmd-\ for a list of available restarts. > Type :? for other options. Thanks Patrick Quote Link to comment Share on other sites More sharing options...
PatrickMimran Posted May 30, 2017 Author Share Posted May 30, 2017 I get it work now Thank you Patrick 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.