????????????seed??????????????????λ?????time_t time(0)??
????#include <ctime>
????//…
????srand((unsigned)time(0));
????for(int i=0;i<10;i++){
????ran_num=rand() % 6;
????cout<<ran_num<<" ";
????}
???????????????????0 1 5 4 5 0 2 3 4 2
????????Σ?3 2 3 0 3 5 5 2 2 3
???????????????н??????????????????????????????????????????1???????£???
????????time_t time(0)??
????time_t?????????????????????1970??1??1?????????????????????????????λ???????????????
????cout<<time(0);
???????1169174701???????37??????365??????24??С?????3600???????????????
????????????ran_num = rand() % 6??
??????rand()????????6?????????????????????????????????[0??6)???????rand()????????????????????
????????????????
????????[a??b)?????????????????rand() % (b-a)??+ a ??????????a????b????
??????a?0??????£???д?rand() % b??
??????????α???????????
??????rand() / double(RAND_MAX)???????0??1??????????????????????????????????????????????????????
????double ran_numf=0.0;
????srand((unsigned)time(0));
????for(int i=0;i<10;i++){
????ran_numf = rand() / (double)(RAND_MAX);
????cout<<ran_numf<<" ";
????}
???????н?????0.716636??0.457725??…??10??0??1?????????????ν?????????
??????????????Χ?????????????????1??10???????
????rand() /(double)(RAND_MAX) ??? rand() /(double)(RAND_MAX/10)
???????н?????7.19362??6.45775??…??10??1??10?????????????ν?????????
????????100??1000???????????????
???????????α???????????????????????????????????…