Answers for "how to program a random number generator in c++"

C++
12

c++ generate random numbers

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
	srand(time(0));

	for (int i = 0; i <= 10; i++)
	{
		cout << rand() % 10 << " ";
	}
}
Posted by: Guest on April-25-2021
1

c++ generate random number

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
	srand(time(0));

	for (int i = 0; i <= 10; i++)
	{
		cout << rand() % 10 << " ";
	}
}
Posted by: Guest on June-23-2021

Code answers related to "how to program a random number generator in c++"

Browse Popular Code Answers by Language