Examveda

hat is the correct formula for generating random numbers in the range (lower,upper) using rand()?

A. rand() % (upper - lower)

B. rand() + lower

C. (rand()%(upper-lower)) + lower

D. (rand()%(upper-lower+1)) + lower

Answer: Option D


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures