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
Philip Newton
March 6, 2001 09:36
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
On 6 Mar 2001, at 9:42, John Peacock wrote:

> wrote:
> > Having said that, having 'rand' returning integers when 'use integer'
> > is in effect fits exactly in Perls DWIM nature.
> I agree that it does fit DWIM, but since rand() returns a float between 
> 0 and 0.999999999, what would the corresponding integer range be:  
> 0-10, 0-100, 0-1000???

I believe Abigail was talking about rand the function, not rand() the 
function called with zero arguments -- specifically, about the output of 
rand( $x ) under 'use integer' for some number $x. Which would 
probably answer your question about the range to use.

Philip Newton <>
I appreciate copies of replies to my messages to Perl5 lists.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About