Discussion :: Library Functions
-
What will the function randomize() do in Turbo C under DOS?
A.
returns a random number. |
B.
returns a random number generator in the specified range. |
C.
returns a random number generator with a random value based on time. |
D.
return a random number with a given seed value. |
Answer : Option C
Explanation :
The randomize() function initializes the random number generator with a random value based on time. You can try the sample program given below in Turbo-C, it may not work as expected in other compilers.
/* Prints a random number in the range 0 to 99 */
#include
#include
#include
int main(void)
{
randomize();
printf("Random number in the 0-99 range: %d\n", random (100));
return 0;
}
Be The First To Comment