Monday, July 27, 2009

Rand function (C)?

I need to generate random integers from 0 to 10 - whats the code?please explain if you can. thanks

Rand function (C)?
http://pegasus.rutgers.edu/~elflord/cpp/...
Reply:If I remember correctly, rand returns if float between 0 and 1. You will need to map that between 0 and 10. Maybe something like y=round(rand()*10);





My C is a little fuzzy right now but something like that should get you going.

blazing star

No comments:

Post a Comment