【C语言】随机数随机种子

 

#include "stdafx.h"

#include <stdlib.h>
#include <time.h>
int main() {
    int a;
    srand((unsigned)time(NULL)); //设置随机种子后 随机数会形成固定的序列
    a = rand();
    printf("%d\n", a);

    getchar();
    return 0;
}

 

posted @ 2020-09-05 18:52  温暖了寂寞  阅读(1434)  评论(0编辑  收藏  举报