php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10837 The "rand" function doesn't work
Submitted: 2001-05-12 23:48 UTC Modified: 2001-06-21 23:39 UTC
From: huy91980 at pacbell dot net Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.0.5 OS: Windows 2000 server
Private report: No CVE-ID: None
 [2001-05-12 23:48 UTC] huy91980 at pacbell dot net
calling: rand(1, 50)-1 will always get 1 !! try it for your self..this bug is only in 4.05  ..i imediately rolled back to 4.04pl1 and it works perfect again.

I didn't compile my module..downloaded the win32 build.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-13 04:48 UTC] derick@php.net
Works for me on Linux:

[derick@aarde seti]$ php -q
<?php
echo rand(1,50)-1;
echo "\n";
?>
27

Did you use srand to seed the random number generator?
(www.php.net/srand)

regards,
Derick
 [2001-05-13 04:49 UTC] derick@php.net
Status: Feedback
 [2001-06-21 23:39 UTC] sniper@php.net
No feedback, most likely user error.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 16:01:29 2024 UTC