SFML community forums
Help => General => Topic started by: 5gum on November 11, 2013, 03:16:09 pm
-
Hello guys,
at first: Sorry for my bad English, I usally speak German but I hope you will understand me. (My question is for your luck very short ;D)
I've got 2.1 and I'm looking for something like the Randomizer in 1.6. but I can't find any similar function. Is there any random function in SFML available?
Thanks for answers
5gum
-
Welcome! :)
The Randomizer got removed since it didn't have anything to do with SFML anymore, plus with C++11 we now have the <random> header that provides much more in a much better way, that also means one shouldn't be using rand() and srand() anymore!
-
Thanks, it works :)
-
If you happen to use Thor, you can still get random numbers in one line, see here (http://www.bromeon.ch/libraries/thor/v2.0/doc/_random_8hpp.html).
C++11 random generators don't allow getting a uniform random number without setting all the engines and distributions up. For C++14, an overloaded function std::pick_a_number() has been proposed (n3551 (http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3551.pdf)).