develooper Front page | perl.perl5.porters | Postings from March 2001

Re: [ID 20010305.005] "use integer" doesn't make rand() return integers

Thread Previous | Thread Next
From:
John L. Allen
Date:
March 5, 2001 13:14
Subject:
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
Pine.SOL.3.91.1010305152722.19255A-100000@gateway.grumman.com


On Mon, 5 Mar 2001, Robert Spier wrote:

> I don't think this is a bug.
> 
> perldoc -f rand says:
> Returns a random fractional number greater than or equal t....
> 
> perldoc integer says:
>        integer - Perl pragma to compute arithmetic in integer
>        instead of double
> 
> As "rand" isn't really a perl-level integer computation, (it can
> almost be thought of as a black box that spits out "random fractional

Right.  use integer;  doesn't affect the output of rand() for the same 
reason it doesn't affect the output of sin(), cos(), atan2(), sqrt(), and 
sub foobar { 1.345682 }

John.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About