From:

Date:

March 6, 2001 11:11Subject:

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

3AA53592.194DA6D6@rowman.comTony Finch wrote: > > >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 think this is one of those cases where the > >user has to make that determination for themselves. > > I suggest 0..1. > I can see some utility for (the original code) use integer; for(;;) { print rand 10; } to return integers from 0..9, and it is even easy to create a patch to do that. The problem comes when someone codes this: use integer; for(;;) { print rand; } because this has no meaning. The range of integers 0..1 is not as easily derivable from rand()'s 0..0.999999999 (you'd have to use round). Since 'use integer' strictly affects mathematic operations, not mathematic functions, I think this is not a good enhancement. John PeacockThread Previous | Thread Next

- [ID 20010305.005] "use integer" doesn't make rand() return integers by fanf
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John L. Allen
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Walt Mankowski
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John L. Allen
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Tony Finch
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by rspier
**Re: [ID 20010305.005] "use integer" doesn't make rand() return integers**by John Peacock- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Philip Newton
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Ronald J Kimball
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Nicholas Clark
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by abigail
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by Bryan C . Warnock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock
- Re: [ID 20010305.005] "use integer" doesn't make rand() return integers by John Peacock

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About