Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-14-2005, 12:01 PM   PM User | #1
Rokas
New Coder

 
Join Date: Mar 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Rokas is an unknown quantity at this point
help: mt_rand strange behaviour

I have such situation. There are a bit more than 10 random values generated in script. Some of them (10,80), some can even be (1,5000) (max value taken from db). But ~every 10-20 time it generates exactly the same set of values. All the other times it generates different set, but it seems like generator chose one set of values which are generated from time to time. I read in php.net that there is no need to seed the generator(using php 5.0.2). Any help?
Rokas is offline   Reply With Quote
Old 06-14-2005, 12:53 PM   PM User | #2
mattyod
New Coder

 
Join Date: Feb 2005
Posts: 97
Thanks: 7
Thanked 7 Times in 7 Posts
mattyod is an unknown quantity at this point
Some of the comments in the livedocs on mt_rand() also mention problems with duplicate numbers on certain set ups.

Suggestions where using rand() instead or seeding with mt_srand() anyway.

G'luck.
mattyod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:41 PM.


Advertisement
Log in to turn off these ads.