/* ------------------------------------------ 乱数を発生するプログラム ------------------------------------------ */ #include #include #include main() { int ransu,n; /* ---- 乱数の初期設定 srand ---- time(NULL)は現在時刻を秒単位の整数で返す関数 */ srand(time(NULL)); /* ---- 乱数の生成 rand ---- 乱数の値は0〜32767までの整数 */ for ( n=0 ; n<10 ; n++ ){ ransu = rand(); printf("%d \n",ransu); } }