随机数

        srand((unsigned)time(NULL));
        int img_index = rand() % 2 + 1;

表示1到2的整数随机数

 

        srand((unsigned)time(NULL));
        int img_index = rand() % 10 + 1;

表示1到10的整数随机数

posted @ 2019-12-25 10:31  曦花  阅读(211)  评论(0编辑  收藏  举报