Generate number between 1000000 and 9999999

Hi all

How to generate a number between 1000000 and 9999999?

Thanks

erlang to the rescue

iex(6)> :crypto.rand_uniform(1000000, 9999999)
4164420
iex(7)> :crypto.rand_uniform(1000000, 9999999)
4035678
iex(8)> :crypto.rand_uniform(1000000, 9999999)
2923210
iex(9)> :crypto.rand_uniform(1000000, 9999999)
7206784

Well that numbers there are a range, ranges are Enums, so Enum.random/1 should do the job.

3 Likes

thanks guys