Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ rand

#include <ctime>

int main() {
 srand((unsigned) time(0)); 
 int result = 1 + (rand() % 6); // return a number between 1 and 6
}
Source by en.cppreference.com #
 
PREVIOUS NEXT
Tagged: #rand
ADD COMMENT
Topic
Name
4+4 =