[erlang-questions] On OTP rand module difference between OTP 19 and OTP 20
Wed Aug 30 08:54:30 CEST 2017
On Wed, Aug 30, 2017 at 03:48:16PM +0900, zxq9 wrote:
> 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.
That's vague for me.
Are you saying it is a common enought use pattern to divide with a
random number? Are there other reasons when a float() =:= 0.0 is fatal?
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions