php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27355 rand() generates even-odd-even-odd numbers
Submitted: 2004-02-22 15:25 UTC Modified: 2004-02-22 22:27 UTC
From: chrisrogers at planetunreal dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.3.4 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
21 + 38 = ?
Subscribe to this entry?

 
 [2004-02-22 15:25 UTC] chrisrogers at planetunreal dot com
Description:
------------
The rand() function under Windows XP Pro and possibly other Windows OSs generates numbers in a strict even-odd-even-odd pattern.  The pattern doesn't occur on *nix OSs

Reproduce code:
---------------
<?php
for (i = 0; i < 100; i++)
    echo rand()."<br />\n";
?>

Expected result:
----------------
expected numbers with no noticable pattern

Actual result:
--------------
numbers were in an even-odd-even-odd pattern

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-22 21:17 UTC] cjbj at hotmail dot com
May be related to bug 27052 which I reproduced (with the same pattern too).
 [2004-02-22 22:27 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

This is already fixed in CVS..

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 01:05:46 2022 UTC