Many programs need random number to complete their certain goal. For example, a quiz program needs random number to randomize the question number to be asked first. Likewise a dice game needs random number to select the face when it is thrown. So there are many situations where the need of random number has no alternatives. Almost all programming languages provide the way to generate random numbers. In the same way C/C++ also provide some functions that generate random numbers. stdlib.h in C and cstdlib in C++ provides a function rand() to generate a random number. This function, when called, returns a integer from 0(0x0000) to 32767 (0x7FFFF).
Random number generation in C/C++
Read more »
تعليقات: 0
إرسال تعليق