Cool.

Here's one result:  http://www.eskimo.com/~ghawk/temp/randplot.png

Here's what I had to do:

D:\PERL\_myStuff>ppm install Chart-Plot
Installing package 'Chart-Plot'...
Bytes transferred: 13610
Installing D:\Perl\html\site\lib\Chart\Plot.html
Installing D:\Perl\site\lib\Chart\Plot.pm
Writing D:\Perl\site\lib\auto\Chart\Plot\.packlist

D:\PERL\_myStuff>ppm install gd
Installing package 'gd'...
Bytes transferred: 225001
Installing D:\Perl\site\lib\auto\GD\GD.bs
Installing D:\Perl\site\lib\auto\GD\GD.dll
Installing D:\Perl\site\lib\auto\GD\GD.exp
Installing D:\Perl\site\lib\auto\GD\GD.lib
Installing D:\Perl\html\site\lib\GD.html
Installing D:\Perl\site\lib\GD.pm
Installing D:\Perl\site\lib\qd.pl
Installing D:\Perl\site\lib\auto\GD\autosplit.ix
Writing D:\Perl\site\lib\auto\GD\.packlist

D:\PERL\_myStuff>randplot.pl

File gets created...   D:\PERL\_myStuff\randplot.png

File randplot.pl contents...

#!perl

use Chart::Plot;
my $img = Chart::Plot->new(400,400);

my @data;
for (1..10000) { push @data, rand() }

$img->setData (\@data,  'black noline points');

open (WR,'>randplot.png') or die ("Failed to write file: $!");
binmode WR;
print WR $img->draw();
close WR;

`randplot.png`;

__END__

Another way to determine how randomly the rand() function is working is to plot
it sorted.  A bad random function might predominate in a particular area, so
you want to see a straight diagonal line in this case, meaning the results are
spread throughout the range.  Here's what it looks like with @data = sort
@data:

http://www.eskimo.com/~ghawk/temp/randplotsorted.png

Gary

> -----Original Message-----
> From: Wagner-David [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 13, 2002 9:20 PM
> To: 'Roger C Haslock'; Gary Hawkins
> Cc: [EMAIL PROTECTED]
> Subject: RE: rand() function
>
>
>       Worked just like stated. I missed that you were pushing on
> @data and used @dataset when going to the img. After I changed that
> and reran, it gave me the graph desired.
>
>       It was as easy as stated.
>       Thanks.
>
> Wags ;)
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to