php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33556 rand is not random !!!. Random number repeat every 32768 time .
Submitted: 2005-07-03 20:31 UTC Modified: 2005-07-03 20:46 UTC
From: toslava at gmail dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 5.0.4 OS: windows 2003
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: toslava at gmail dot com
New email:
PHP Version: OS:

 

 [2005-07-03 20:31 UTC] toslava at gmail dot com
Description:
------------
rand is not random !!!. Random number repeat every 32768 time     
  :-(((

 _ 0 _ 	 _ 8512030 _ 
 _ 1 _ 	 _ 5655227 _ 
 _ 2 _ 	 _ 6934082 _ 
 _ 3 _ 	 _ 2293270 _ 

.......
 _ 32768 _    _ 8512030 _ 
 _ 32769 _    _ 5655227 _ 
 _ 32770 _    _ 6934082 _ 
 _ 32771 _    _ 2293270 _ 
......

Reproduce code:
---------------
echo '<pre>';

for ($i=0; $i<160000; $i++) {
$ch01=rand(900000, 9999999);
echo " _ $i _ \t _ $ch01 _ \n"; }

Expected result:
----------------
..... 
  realy  random number !

Actual result:
--------------
 _ 0 _ 	 _ 8512030 _ 
 _ 1 _ 	 _ 5655227 _ 
 _ 2 _ 	 _ 6934082 _ 
 _ 3 _ 	 _ 2293270 _ 

.......
 _ 32768 _    _ 8512030 _ 
 _ 32769 _    _ 5655227 _ 
 _ 32770 _    _ 6934082 _ 
 _ 32771 _    _ 2293270 _ 
......

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-03 20:46 UTC] helly@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Ask Microsoft, php just wraps a windows api function.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:30 2024 UTC