basho / node_package

RPM/Debian/FreeBSD/SmartOS/Solaris/OSX packaging templates for Erlang Nodes
Apache License 2.0
89 stars 63 forks source link

Usage of random module is deprecated in otp19 [JIRA: TOOLS-474] #213

Closed larshesel closed 7 years ago

larshesel commented 7 years ago

Hi

After switching to a new version of the node_package I get warnings when interacting with my generated release:

_build/default/rel/vernemq/bin/vernemq ping
/home/lhc/dev/erl.io/vernemq/_build/default/rel/vernemq/bin/../erts-8.2.1/bin/nodetool:192: Warning: random:seed/1: the 'random' module is deprecated; use the 'rand' module instead
/home/lhc/dev/erl.io/vernemq/_build/default/rel/vernemq/bin/../erts-8.2.1/bin/nodetool:195: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
/home/lhc/dev/erl.io/vernemq/_build/default/rel/vernemq/bin/../erts-8.2.1/bin/nodetool:197: Warning: random:uniform/1: the 'random' module is deprecated; use the 'rand' module instead
pong

It seems to be due to the usage of random introduced recently:

https://github.com/basho/node_package/commit/413a4aba1d8ccabd1faf229e1f904196f98e92fa

the only simple solution I can think of would be to replace the random:uniform(1000) with erlang:phash2(os:getpid(), 1000)? Then there's also no need for the random:seed(os:timestamp) line.

I'd be happy to create a PR for this.

larshesel commented 7 years ago

Since #214 was merged I'll close this. Thanks!