ã¿ãªãããããã«ã¡ã¯ãä»åã¯ä¹±æ°ã®è©±ã§ãã ç¹ã«è¤æ°æ©ç¨®ã§ã®ã³ã³ã·ã¥ã¼ãæ©ã§ã²ã¼ã ãéçºããã¦ããã¨ãæ©ç¨®éã§ä¹±æ°å¤ãçµ±ä¸ããããã«ä¹±æ°çæã¢ã«ã´ãªãºã ãèªä½ãã¾ãããã ããã§ãã使ãããã¢ã«ã´ãªãºã ããç·å½¢ååæ³ãã§ããå 容ã¯è³ã£ã¦ç°¡åã§ã以ä¸ã®æ¼¸åå¼ã使ãã¾ãã A,B,Mã¯å®æ°ã§ãã©ã®å¤ãå ¥ããã¯å¦çç³»ä¾åã§ãã ä¾ãã°Unixãªã©ã®å¦çç³»ã§ã¯A=1103515245,B=12345,M=2147483647ãªã©ãå ¥ãã¾ãã Cè¨èªã§ãã¨ä»¥ä¸ã®ããã«ãªãã¾ãã static unsigned int x=1; void srand(unsigned int s) { x=s; } unsigned int rand() { x=x*1103515245UL+12345UL; return x&2147483647UL; } ãã®ãç·å½¢ååæ³ãã¯è¨ç®ãç°¡åã§é«éã§ãããããããããªç°
{{#tags}}- {{label}}
{{/tags}}