SFML community forums
Help => System => Topic started by: Chuckleluck on June 11, 2012, 06:08:17 pm
-
Hello,
I've used SFML 1.6 for a little while, and when I made the switch to SFML 2, I noticed sf::Randomizer is gone. Why was it removed? And is there a new method built into SFML 2 that I could use to get random numbers?
Thanks.
-
The C++ standard has a random number generator, there was no point having a thin wrapper in SFML.
-
Also the forum search would have answered you're question... ::)
-
Oh...heheh... :o
Thanks for the quick answer Laurent. :D
-
std::rand is a bit lame imo... but there is a neat randomiser in boost you can use if you like?
http://www.boost.org/doc/libs/1_49_0/doc/html/boost_random.html
It can do a lot more cool stuff, and I switched to it form my hobby project I am doing outside of school for random map generation. As you can have all sorts of restrictions and properties on the random numbers generated. Coll stuff like probabilities. Like for example, gen 100 numbs (1-100) but 50 of them have to be 5 (5 == tree sprite in my game for example.) but out of those 5 trees X trees are normal, y trees are rare and z trees are super rare and have a wood nymph living in it.. )
-
By the way, the Boost.Random functionality is also available in the C++11 standard library and in TR1 (slightly different).
-
The C++ standard has a random number generator, there was no point having a thin wrapper in SFML.
I know I'm late to this particular party, but I think that was a bad idea. The C++ random lib is a bit, well, pants.