SFML community forums

Help => System => Topic started by: Chuckleluck on June 11, 2012, 06:08:17 pm

Title: SFML 2 Randomizer
Post 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.
Title: Re: SFML 2 Randomizer
Post by: Laurent on June 11, 2012, 06:53:13 pm
The C++ standard has a random number generator, there was no point having a thin wrapper in SFML.
Title: Re: SFML 2 Randomizer
Post by: eXpl0it3r on June 12, 2012, 03:12:23 pm
Also the forum search would have answered you're question... ::)
Title: Re: SFML 2 Randomizer
Post by: Chuckleluck on June 12, 2012, 06:57:12 pm
Oh...heheh... :o

Thanks for the quick answer Laurent.  :D
Title: Re: SFML 2 Randomizer
Post by: aNewHobby on June 28, 2012, 06:53:38 am
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.. )
Title: Re: SFML 2 Randomizer
Post by: Nexus on June 28, 2012, 08:11:45 pm
By the way, the Boost.Random functionality is also available in the C++11 standard library and in TR1 (slightly different).
Title: Re: SFML 2 Randomizer
Post by: Walks_With_Gaia on August 04, 2021, 11:35:40 pm
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.