C++0xã®std::randomã«ã¯ãæ§ã
ãªåå¸ã¯ã©ã¹ãåå¨ãããä¸ä½ã©ããã£ã¦ä½¿ãåããã°ããã®ããããã§ã¯ãã²ã¼ã ã«ãã¨ãã¦èãã¦ã¿ãã ãã£ã¨ãç°¡åãªåå¸ã¯ãä¸æ§åå¸ï¼Uniform distributionsï¼ã§ãããããã¯ãa ⦠i ⦠b, ã®ç¯å²ã®å¤iããããããçãã確çã§è¿ãåå¸ã§ããã ã²ã¼ã ã§ããã°ããµã¤ã³ããã«ã¼ã¬ãããªã©ã®å®è£
ã«ä½¿ããã ããã // å
é¢ãµã¤ã³ãã®å®è£
int main() { std::mt19937 rng ; // ä¸æ§åå¸ // 0ãã5ã¾ã§ã®æ°åãçãã確çã§è¿ãåå¸ std::uniform_int_distribution<> dice(0, 5) ; int a[6] = { } ; // å
é¢ãµã¤ã³ãã®åºãç®ã®åæ°ãè¨é²ããé
å // 600åãµã¤ã³ããæ¯ã for ( int i = 0 ; i != 600 ; ++i )
{{#tags}}- {{label}}
{{/tags}}