#26381 [Fbk->Opn]: rand() without srand() doesn't work

From: Date: Tue, 25 Nov 2003 09:53:44 +0000
Subject: #26381 [Fbk->Opn]: rand() without srand() doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-50973@lists.php.net to get a copy of this message
 ID:               26381
 User updated by:  spam at vrana dot cz
 Reported By:      spam at vrana dot cz
-Status:           Feedback
+Status:           Open
 Bug Type:         Math related
 Operating System: Windows XP
 PHP Version:      4.3.3
 New Comment:

Unfortunately it behaves the same with Windows snapshots.

For case it's not obvious from my fist comment - if I call srand()
before rand() it works well.


Previous Comments:
------------------------------------------------------------------------

[2003-11-25 04:24:32] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Works fine for me within Windows XP, within Apache and CLI.


------------------------------------------------------------------------

[2003-11-24 08:21:33] spam at vrana dot cz

Description:
------------
Function rand() without setting random seed by srand() returns always
the same value. It doesn't work only on Windows PHP-CLI. As Windows
Apache module and also on Linux PHP-CLI it works as it should.

Reproduce code:
---------------
echo rand();

Expected result:
----------------
(random value)

Actual result:
--------------
24849


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26381&edit=1


Thread (21 messages)

« previous php.bugs (#50973) next »