mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
FS#153 - Fix the initial seed of sf::Randomizer which is always the same on some configurations
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1412 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
b3d3082fc4
commit
5bec10de6c
@ -26,8 +26,8 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Randomizer.hpp>
|
||||
#include <SFML/System/Platform.hpp>
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
namespace
|
||||
@ -35,7 +35,7 @@ namespace
|
||||
// Set the random numbers sequence seed with the current system time, so that it is always different
|
||||
unsigned int SetRandomSeed()
|
||||
{
|
||||
unsigned int Seed = static_cast<unsigned int>(sf::priv::Platform::GetSystemTime() * 1000);
|
||||
unsigned int Seed = static_cast<unsigned int>(time(NULL));
|
||||
srand(Seed);
|
||||
return Seed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user