Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with sf::Randomizer. Seed isn't set in other threads  (Read 5386 times)

0 Members and 1 Guest are viewing this topic.

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Hello,
I've noticed, that the Seed of sf::Randomizer is not automatically set if I use it in another thread than the main thread. This occures also if I use std::rand directly. Is there a workaround so that SFML sets the seed also automatically in other threads, or have I to set the seed in every thread myself?

Maybe SFML could set the seed everytimes a new thread is opened.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Problem with sf::Randomizer. Seed isn't set in other threads
« Reply #1 on: July 09, 2009, 01:57:22 pm »
This is a bug of some compilers, although the standard clearly says (as far as I remember) that the seed should be global to every thread.

I can't help much about that, sorry.
Laurent Gomila - SFML developer

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Problem with sf::Randomizer. Seed isn't set in other threads
« Reply #2 on: July 09, 2009, 02:10:45 pm »
Ok, thanks for the answer. So I have to care about the seed.

 

anything