Wednesday, October 17, 2018

Random generator

Describe how random generation works in our games. What does the rand() function do, and how can you alter the range of the numbers it produces? Provide several examples explaining different ranges of numbers.
The rand is randomly generating numbers and you can add a restriction by adding the % and a number, that will set the range of the preferred numbers. For example rand()%100+1 is a random number between 0 and 100. 

No comments:

Post a Comment