Below is my code:
uniform_int_distribution<>temp(-1,1);
default_random_engine e((unsigned int)time(0));
for(int a=0;a<50;a++){
cout<<temp(e)<<endl;
}
You know, I expect the number range is -1,0,1 ,these three numbers. Actually the result normally only contains 0 and 1. If I run this program several times, then, seldom the -1 number will be last number of one time. I don't know why, uniform_int_distribution should contains -1, right?
This is a bug that has apparently been fixed: http://connect.microsoft.com/VisualStudio/feedback/details/712984
If you need a workaround right now without installing software updates, why not just generate between 0 and 2, then subtract 1 afterwards?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With