生成随机数 #include <time.h> srand(time(NULL) ); //生成种子,做一次否则随机数是递增和递减的 int b; b = rand()%20;//0-20的随机数,这里可以进入循环,产生真正随机数