Dec 17, 2009 · It produces pseudo random numbers between 0 and 1. Generating integer random numbers. Suppose we want to emulate the process of throwing a dice. The dice has 6 faces with numbers from 1 to 6. How can we use the random number function for generating a random integer between 1 and 6? We need to translate the output (0 to 1) of the rand() function ... This number square can be used for many types of maths practice - shading in numbers divisible by 2, 3, 4, etc. identifying prime numbers, "square" numbers, etc. We've set up a number of free-to-print worksheets based on this square, as shown in the table below - see also the print-on-A4 page for Numbers 1 to 1000 (which can be enlarged on a ... Number of integers between 1 and 100 : 2, 3 , 4, 5 , .....99. so, sample space { or total outcomes } = 98. So, you can say total number of sample space , n (S) = 98. Now , numbers , which are divisible by 8 are : 8 , 16 , 24 , 32, 40 , 48 , 56, 64, 72 , 80, 88 , 96. So, total number which are divisible by 8 = 12. With this in mind, the expression rand() % high + 1 would generate a number between 1 and high, inclusive, where high is less than or equal to RAND_MAX, a constant defined by the compiler. To place a lower bound in replacement of 1 on that result, we can have the program generate a random number between 0 and (high - low + 1) + low.