📜  在 C++ 代码示例中为随机数生成器分配种子

📅  最后修改于: 2022-03-11 14:44:57.469000             🧑  作者: Mango

代码示例1
//Decalare a variable to be used as a seed.
int seed; //variable name seed is declared
//Assign the decalred variable "seed" to be a seed for the random number generator. 
srand(seed);
//Prompt user to enter a seed
cout<<"Enter a seed variable "<< endl;
cin >> seed;