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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 19:03:38 2021 UTC