Random number generator (device): Difference between revisions
Content added Content deleted
(add Standard ML) |
(→{{header|Ruby}}: added specifying RNG example) |
||
Line 1,246: | Line 1,246: | ||
{{works with|Ruby|1.8.7}} |
{{works with|Ruby|1.8.7}} |
||
<lang Ruby>require 'securerandom' |
<lang Ruby>require 'securerandom' |
||
SecureRandom.random_number(1 << 32) |
SecureRandom.random_number(1 << 32) |
||
#or specifying SecureRandom as the desired RNG: |
|||
p (1..10).to_a.sample(3, random: SecureRandom) # =>[1, 4, 5] |
|||
</lang> |
|||
=={{header|Rust}}== |
=={{header|Rust}}== |