 (defn gaussian-noise-factor
   "Returns gaussian noise of mean 0, std dev 1."
   []
-  (* (Math/sqrt (* -2.0 (Math/log (rand))))
-    (Math/cos (* 2.0 Math/PI (rand)))))
+  (* (Math/sqrt (* -2.0 (Math/log (lrand))))
+    (Math/cos (* 2.0 Math/PI (lrand)))))
 
 (defn perturb-with-gaussian-noise 
   "Returns n perturbed with std dev sd."

  [tree]
  (if (seq? tree)
    (if (> (lrand) @global-node-selection-leaf-probability)
      (second (rand-nth (filter #(seq? (first %)) (map #(list %1 %2) (all-items tree) (iterate inc 0)))))
      (let [indexed-leaves (filter #(not (seq? (first %))) (map #(list %1 %2) (all-items tree) (iterate inc 0)))]
        (if (empty? indexed-leaves) 0 (second (rand-nth indexed-leaves)))))
    0))

(defn choose-node-index-by-tournament

(def global-pop-when-tagging (atom true))
(def global-reuse-errors (atom true))

(def global-use-single-thread (atom false))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; random code generator

