ぼるじょあがC/C++の宿題を片づけますYO! 42代目
レス数が900を超えています。1000を超えると表示できなくなるよ。
0930デフォルトの名無しさん
2005/05/10(火) 00:20:11#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int fortune(){
static int s=0;
static const char *msg[]={"大凶","凶","吉","中吉","大吉"};
int n,r,c;
if(!s){ srand((unsigned)clock()); ++s; }
r=(int)(20.0*rand()/(RAND_MAX+1.0));
c="43333222222222211110"[r]-'0';
puts(msg[c]);
return c;
}
2進数の乱数を5の倍数で割った場合計算誤差で偏らないか気になる。。。
レス数が900を超えています。1000を超えると表示できなくなるよ。