Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2005
    Thanked 0 Times in 0 Posts

    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?

  2. #2
    New Coder
    Join Date
    Feb 2005
    Thanked 7 Times in 7 Posts
    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts