<div dir="ltr">I finally reviewed OTP rand module change between 19.3 and 20.0.<br>While most of users won't recognize the changes,<br>the details are considerably different.<br><br>A good news is that if you're not aware of the PRNG algorithm<br>you can keep the code untouched. The new default algorithm<br>works ok and even better than the OTP 19 with less bugs.<br><br>On the other hand, if you explicitly specify the algorithm in rand:seed/1,<br>you are suggested to use a newly-available algorithms<br>described in the rand module manual of OTP 20.0. Actually<br>all the old (OTP 18 and 19) algorithms are now deprecated.<div>See rand module manual of OTP 20. Use exrop (default of OTP 20) in most cases;</div><div>if you use exs1024 that should be changed to exs1024s;</div><div>if you stick with exsplus (default until OTP 19), use exsp instead.</div><div>If you use other algorithms, consider converting to exrop.<br><br>Also, if your code depends on the output range of<br>rand:uniform/1 or rand:uniform_s/1, it has been changed as follows:<br>OTP 18 and 19: 0.0 < X < 1.0<br>OTP 20: 0.0 =< X < 1.0 (note the =< operator)<br>where X is the output of the functions.</div><div>In short, since OTP 20, the functions may output 0.0.<br><br>I noticed the changes shortly after OTP 20.0 release.<br>These changes were in the last minute (19-MAR-2017 - 26-APR-2017)</div><div>just before the OTP 20 release<br>and after my Erlang and Elixir Factory 2017 trip so I didn't notice.<br>I was not notified at all by Raimo Niskanen and other contributors<br>about these changed either,</div><div>so I had to take time and chance to review the code again.<br>I know OTP is open source software and the OTP Team can modify<br>the code for better features and removing bugs without notifying to anyone,<br>so nobody is to blame on these changes.<br>I'm assured that Raimo and the other contributors have done a great job<br>on changing the details while maintaining the compatibility<br>and fixing the trivial bugs which I left in the code.<br><br>I would also like to note that crypto module also utilizes<br>the rand module API to simplify access to cryptographically strong<br>random number module since OTP 20. See crypto:rand_seed/{0,1}<br>and crypto:rand_uniform/2. This is a good example to make use of<br>rand module's extensible plugins.<br></div><div><br></div><div>Thanks to Tuncer Ayaz for giving me a chance to review this.</div><div><br></div><div>And always remember: if you are still dependent on random module,</div><div>migrate to rand module now.</div><div><br></div><div>Regards,</div><div>Kenji Rikitake</div></div>