Earlier quoted context omitted.
You misunderstand me. I think random(3) should have been omitted from the C standard.
What happens if you don't provide sensible, easy-to-use built-in implementations of things is that a diverse, bewildering ecosystem of different options tends to arise, confusing programmers who just want to get their job done and leading to a high probability of them picking the wrong thing. See, for example, crypto before NaCl came around. (NB: I'm not defending either this C++ standard or random(3).)
The C++ community is polarized about C++11's random-number facility
31–40 of 67 posts
Re: The C++ community is polarized about C++11's random-number facility
#32Earlier quoted context omitted.
What happens if you don't provide sensible, easy-to-use built-in implementations of things is that a diverse, bewildering ecosystem of different options tends to arise, confusing programmers who just want to get their job done and leading to a high probability of them picking the wrong thing. See, for example, crypto before NaCl came around. (NB: I'm not defending either this C++ standard or random(3).)
I thought NaCl was something related to browser plugins. What is the connection with crypto?
Although, I've never actually seen it used in the wild.
Re: The C++ community is polarized about C++11's random-number facility
#33The specification, as far as I'm aware, gives no guarantees at all about the algorithm used. Why not just specify a good algorithm instead of adding a new function?
Re: The C++ community is polarized about C++11's random-number facility
#34>In fact, anything that's easy to do with Python's RNG class is just as easy to do here—in designing the class, wanted random number generation in C++ to become as easy as it is in Python
>But don't just take my word for it, download randutils.hpp and play around. Start having actual fun with random number generation.
Re: The C++ community is polarized about C++11's random-number facility
#35Earlier quoted context omitted.
Because Microsoft implemented random_device correctly while MingW / GCC hasn't? Its a bug in MingW. Which isn't a big deal because Microsoft Visual Studio Community Edition is an excellent IDE and compatible with OSS projects now.
Could you point to the gcc bug? Note: the standard does not require a non-deterministic random_device, at least C++11 doesn't, so the behaviour as described in the stackoverflow link would be allowed.
Re: The C++ community is polarized about C++11's random-number facility
#36Earlier quoted context omitted.
Could you point to the gcc bug? Note: the standard does not require a non-deterministic random_device, at least C++11 doesn't, so the behaviour as described in the stackoverflow link would be allowed.
There are a lot of things the C and C++ standards allow implementations to do, such as making int 16 bits, using one's complement for signed integers, (in C) only making the first 31 characters of identifiers significant, (in C++) not allowing any identifiers longer than one character, except those in the standard library, et cetera. This is because they are designed to be portable to a wide variety of compilers and…
That's not really the case here, is it? If anything the bug is in the standard.
Re: The C++ community is polarized about C++11's random-number facility
#37Why not specify the algorithm for std::rand? The specification, as far as I'm aware, gives no guarantees at all about the algorithm used. Why not just specify a good algorithm instead of adding a new function?
And this lets you (easily) generate more than just integers in the range [0, INT_MAX]. std::rand doesn't have that level of convenience.
There are all sorts of inconveniences with std::rand, and it looks like this solves the vast majority of them.
Re: The C++ community is polarized about C++11's random-number facility
#38One thing that I would like to have is a common base class that can be passed around. Often, I would like for a function orclass to be told which engine to use, quite useful for unit testing, or for having reproducible results. As it is, the only way to accept multiple different engines is by templating over the engine type. This ends up requiring that every part of the code that uses the random engine be brought int…
Re: The C++ community is polarized about C++11's random-number facility
#39"To the extent that anyone cares about C++11's random-number facility at all, the C++ community is polarized between two views—one that likes it, and one that hates it." Isn't that almost a tautology? "People who care about X either love it or hate it".
Re: The C++ community is polarized about C++11's random-number facility
#40Why not specify the algorithm for std::rand? The specification, as far as I'm aware, gives no guarantees at all about the algorithm used. Why not just specify a good algorithm instead of adding a new function?
> The specification, as far as I'm aware, gives no guarantees at all about the algorithm used.
You are right about that. And, in fact, the few guarantees the standard has are weak enough that Microsoft ships a standards compliant implementation that is famously limited.