a) rand() % (upper – lower)
b) rand() + lower
c) (rand()%(upper-lower)) + lower
d) (rand()%(upper-lower+1)) + lower
What is the correct formula for generating random numbers in the range (lower,upper) using rand()?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What is the correct formula for generating random numbers in the range (lower,upper) using rand()?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!