wizard Posted April 2, 2016 Share Posted April 2, 2016 У нас такая или нет ? double randRange(double min, double max) { double r = (double)rand() / 32767.0; return min + r * (max - min); } if (randRange(0.0, 100.0) < сhange) dosmth(); 0 Quote Link to comment Share on other sites More sharing options...
0 Admin Posted April 2, 2016 Share Posted April 2, 2016 У нас не формула. 0 Quote Link to comment Share on other sites More sharing options...
0 GGumbo Posted April 3, 2016 Share Posted April 3, 2016 /dev/random либо нечто подобное =) 0 Quote Link to comment Share on other sites More sharing options...
0 HeadMaster Posted April 3, 2016 Share Posted April 3, 2016 Скорее всего у нас готовая последовательность используется. Только это не имеет значения для игроков. Для нас рандом вполне себе равномерный. Вычислить или воспроизвести последовательность не реально, так как она тысячу раз в секунду дергается. 0 Quote Link to comment Share on other sites More sharing options...
Question
wizard
У нас такая или нет ?
double randRange(double min, double max)
{
double r = (double)rand() / 32767.0;
return min + r * (max - min);
}
if (randRange(0.0, 100.0) < сhange)
dosmth();
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.