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

Author Topic: SFML 2.1 Randomizer?  (Read 4022 times)

0 Members and 1 Guest are viewing this topic.

5gum

  • Newbie
  • *
  • Posts: 27
    • View Profile
SFML 2.1 Randomizer?
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: SFML 2.1 Randomizer?
« Reply #1 on: November 11, 2013, 03:19:23 pm »
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!
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

5gum

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML 2.1 Randomizer?
« Reply #2 on: November 11, 2013, 04:02:39 pm »
Thanks, it works :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2.1 Randomizer?
« Reply #3 on: November 11, 2013, 07:47:40 pm »
If you happen to use Thor, you can still get random numbers in one line, see here.

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).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything