Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to make a random number in c++

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main() {
	srand(time(NULL)	);
	const char arrayNum[7] = {'0', '1', '2', '3', '4', '5', '6'};
	int RandIndex = rand() % 7;
	cout<<RandIndex<<endl;
	return 0;
}
Source by www.bitdegree.org #
 
PREVIOUS NEXT
Tagged: #random #number
ADD COMMENT
Topic
Name
8+8 =