Kyorai / riak_core

Distributed systems infrastructure used by Riak.
Apache License 2.0
101 stars 23 forks source link

rand module2 #6

Closed getong closed 7 years ago

getong commented 7 years ago

I get the riak_core_ng from the hex.pm, but found the random module is still being used. And I diff the riak_core_ng code with the branch 0.9.0, and they are the same. So I make the pr on the branch 0.9.0. update the chash to version 0.1.2, and then update the lock file.

Licenser commented 7 years ago

Hi getong, first of all thank you for this! using rand in newer versions of Erlang it definitely a needed improvement! But (there is always a but isn't there?) I think the approach is a bit problematic. The way you achived this cause a lot of code duplication and will later on make merging upstream changes a hell. A better approach would be to add a single random_uniform (and perhaps random_uniform_s) function to riak_core_util the same way it's for crypto functions. That way the code for calling random is only duplicated in a single place and everything else is just 1 line changes that later merges can work out nicely. Do you agree that this would be a approach more beneficial in the long run?