8:49:10jdzHow useful is it that (random 1.0) may return zero?
8:49:19jdzIt does not seem to happen in ClozureCL.
8:57:13ShinmeraWhat do you mean, "useful". It returns a non-negative number, and thus in order to be unbiased it has to be able to return 0.
8:58:32jdzI'm looking at https://en.wikipedia.org/wiki/Reservoir_sampling#An_optimal_algorithm, and thinking about how would one generate a random number in the range (0,1).
9:04:31scymtymi'm not sure whether this guaranteed to work out numerically, but maybe something like (+ least-positive-single-float (random (- 1.0f0 (* 2.0f0 least-positive-single-float)))) ?
9:06:10jdzRight, I was thinking about how to get the least-positive-single-float, should have tried pressing tab.
9:06:30jdzStill, ClozureCL (and maybe ECL too) don't seem to ever generate a 0.0.
9:06:38scymtymactually, SINGLE-FLOAT-EPSILON may be more appropriate
9:09:39scymtymsince the property of SINGLE-FLOAT[-NEGATIVE]-EPSILON is stated explicitly for addition, maybe (- 1.0f0 single-float-negative-epsilon single-float-negative-epsilon) is the safest option
9:13:12jdzOK, given small enough floats, CCL and ECL seem able to come up with zero. Thanks for the input guys.