Returns the distribution in which each element x of the collection
has a probability proportional to (f x)
(defn make-distribution
"Returns the distribution in which each element x of the collection
has a probability proportional to (f x)"
[coll f]
(normalize (into {} (for [k coll] [k (f k)]))))
Comments top
No comments for make-distribution. Log in to add a comment.