Quantcast

Erlang 20 and crypto:rand_uniform/2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Erlang 20 and crypto:rand_uniform/2

Richard Bowker
Erlang 20-RC1 gives the following warning

`crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1`

Is there any reason why we wouldn't want to provide a rand:uniform/2 with a matching Lo/Hi api for convenience of retrofitting?


cheers

Rich

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Erlang 20 and crypto:rand_uniform/2

Richard Bowker
Reposting, apologies, hadn't noticed it had switched to HTML mail.

Rich

--- [hidden email] wrote:
From: "Richard Bowker" <[hidden email]>
To: <[hidden email]>
Subject: [erlang-questions] Erlang 20 and crypto:rand_uniform/2
Date: Tue, 16 May 2017 09:55:18 -0700

Erlang 20-RC1 gives the following warning
`crypto:rand_uniform/2 is deprecated and will be removed in a future
release; use rand:uniform/1`
Is there any reason why we wouldn't want to provide a rand:uniform/2
with a matching Lo/Hi api for convenience of retrofitting?
cheers
Rich

_______________________________________________ erlang-questions
mailing             list            [hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Erlang 20 and crypto:rand_uniform/2

Raimo Niskanen-2
On Wed, May 17, 2017 at 12:16:32AM -0700, Richard Bowker wrote:

> Reposting, apologies, hadn't noticed it had switched to HTML mail.
>
> Rich
>
> --- [hidden email] wrote:
> From: "Richard Bowker" <[hidden email]>
> To: <[hidden email]>
> Subject: [erlang-questions] Erlang 20 and crypto:rand_uniform/2
> Date: Tue, 16 May 2017 09:55:18 -0700
>
> Erlang 20-RC1 gives the following warning
> `crypto:rand_uniform/2 is deprecated and will be removed in a future
> release; use rand:uniform/1`
> Is there any reason why we wouldn't want to provide a rand:uniform/2
> with a matching Lo/Hi api for convenience of retrofitting?

Not really.  The rand module replaced the random module, and from there
came no uniform/2 function. It did not exist since it is so simple
to do it yourself.

The function crypto:rand_uniform/2 was created from the underlying
libcrypto function, which has the Lo,Hi arguments.

There is so little gain in a uniform/2 function that I do not think it
is worth implementing.  Maybe arity 2 should be used for somehing completely
different as an option list, distribution type, or whatnot...

> cheers
> Rich
>

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...