JonyEpsilon / algebolic

Evolving mathematical expressions in Clojure
MIT License
19 stars 1 forks source link

Ability to seed random number generator #6

Open JonyEpsilon opened 10 years ago

JonyEpsilon commented 10 years ago

Will probably need to switch all of the random calls. Not sure how this will work with multi-threading.

JonyEpsilon commented 10 years ago

This is going to be be difficult to make work with multi-core operation.

JonyEpsilon commented 9 years ago

Need to figure out a way to do this, at least in test fixtures, as it's painful having to track down bugs by hand. A fallback option would be to feed the random numbers into the functions that need them:

(defn crossover-internal [expr1 expr1 p1 p2] ...)

(defn crossover [expr1 expr2]
  (crossover-internal expr1 expr1 (rand (size expr1)) (rand (size expr2))))

At least, then, crossover-internal would be testable.