1.4k views
18 votes
In a video game, the chance of rain each day is always 30%. At the beginning of each day in the video game, the computer generates a random integer between 1 and 50. Explain how you could use this number to stimulate the weather in the video game.

User Smoothumut
by
5.4k points

1 Answer

8 votes

Answer: See below

Explanation:

30% * 50

= 30/100 * 50

= 15

Therefore, 30% of the integers between 1 and 50 are in the range 1 to 15

So the random integer generated is in this range, that is, less than or equal to 15, then the weather must be simulated to be rainy.

This would mean that the chance of rain on each day is 30% (if the computer generates the random number consistently)

User William Dwyer
by
5.2k points