[erlang-questions] On OTP rand module difference between OTP 19 and OTP 20

zxq9 <>
Wed Aug 30 08:48:16 CEST 2017


On 2017年08月30日 水曜日 08:42:02 Raimo Niskanen wrote:
> On Wed, Aug 30, 2017 at 11:44:57AM +1200, Richard A. O'Keefe wrote:
> > 
> > 
> > On 29/08/17 8:35 PM, Raimo Niskanen wrote:
> > >
> > > Regarding the changed uniform float behaviour: it is the functions
> > > rand:uniform/0 and rand:uniform_s/1 this concerns.  They were previously
> > > (OTP-19.3) documented to output a value 0.0 < X < 1.0 and are now
> > > (OTP-20.0) documented to return 0.0 =< X < 1.0.
> > 
> > There are applications of random numbers for which it is important
> > that 0 never be returned.  Of course, nothing stops me writing
> 
> What kind of applications?  I would like to get a grip on how needed this
> function is?

Any function where a zero would propagate.

This can be exactly as bad as accidentally comparing a NULL in SQL.

-Craig


More information about the erlang-questions mailing list