Random number generator (device): Difference between revisions
Content added Content deleted
(→{{header|Pascal}}: add example) |
(→{{header|Perl 6}}: add entry) |
||
Line 280: | Line 280: | ||
print "$_\n" for read_random(10);</lang> |
print "$_\n" for read_random(10);</lang> |
||
/dev/urandom is not necessarily good enough for cryptographic work, though. |
/dev/urandom is not necessarily good enough for cryptographic work, though. |
||
=={{header|Perl 6}}== |
|||
A lazy list of random numbers: |
|||
<lang perl6>my $UR = open("/dev/urandom", :bin) or die "Can't open /dev/urandom: $!"; |
|||
my @random-spigot := gather loop { take $UR.read(1024).unpack("L*") } |
|||
.say for @random-spigot[^10];</lang> |
|||
{{out}} |
|||
<pre>1431009271 |
|||
1702240522 |
|||
670020272 |
|||
588612037 |
|||
1864913839 |
|||
2155430433 |
|||
1690056587 |
|||
385405103 |
|||
2366495746 |
|||
692037942</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |