php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9277 Bogus warning with rand(a,b) where a == b
Submitted: 2001-02-15 07:43 UTC Modified: 2001-02-19 14:14 UTC
From: jukkaho at mail dot student dot oulu dot fi Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.4pl1 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jukkaho at mail dot student dot oulu dot fi
New email:
PHP Version: OS:

 

 [2001-02-15 07:43 UTC] jukkaho at mail dot student dot oulu dot fi
$value=rand(0,0);

Gives "Warning: rand(): Invalid range: 0..0 in ..." while there is nothing wrong with it. Value shouldn't be invalid.

I'm expecting a value of 0 with probability of 100% without any warnings or is this a feature?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-15 13:04 UTC] derick@php.net
It's not a bug, it's clear that this was supposed not to work. And if you try rand (1,1) it wont work either.
Another thing; I don't see why this would be usefull.
 [2001-02-19 14:14 UTC] derick@php.net
After an e-mail comversation, Jukka made it clear it is useful, so I commit a "fix" to the CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC