Re: Generating a Random Number

Tech-Archive recommends: Fix windows errors by optimizing your registry



For example:

(rand() % 1272) + 128;

Make sure you call srand() somewhere before that. Use 1273
if you want the value 1400 to be in the range.

Note I assumed you want a random integer.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Abhi" <Abhi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CEEFDBFB-BD70-46CD-84CE-A54A749C6417@xxxxxxxxxxxxxxxx
How would I generate a random number within a range for example between
128
and 1400 ?


.



Relevant Pages