in reply to Srand versus rand
in thread Pi calculator
Look to CPAN and you will find some of what you need. First off, if you are going to write your own "random" sequence generator you my find PDL handy. If you want someone else to do the work on random numbers try Math::Random or Math::TrulyRandom but I would recommend you find an OS specific random source like Linux's /dev/random and /dev/urandom
#!/usr/bin/perl -w use strict; #use Linux; ## I wish. =) (yeah yeah, $^O, etc etc) open UR, "</dev/urandom" or die "Oh man, your system sucks, $!"; my $pages= shift()+0 || 1; die "Give me a number greater than 0 or nothing, bub.\n" unless $pages +>0; while ($pages-->0) { my $buf; read UR, $buf, 512 or die "Ouch that shouldn't happen, $!"; for (0..31) { print vec($buf,$_*4,32), "\t", vec($buf,$_*4+1,32), "\t", vec($buf,$_*4+2,32), "\t", vec($buf,$_*4+3,32), "\n"; } }
--
$you = new YOU;
honk() if $you->love(perl)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Srand versus rand
by Fingo (Monk) on Feb 16, 2001 at 16:12 UTC | |
by gryng (Hermit) on Feb 16, 2001 at 18:26 UTC |