Re: Generating a Random Number
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Tue, 19 Jun 2007 14:09:33 -0700
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 ?
.
- Prev by Date: Re: ms CRT(stdio) bug?
- Next by Date: Re: Using VS2005/C++, how to create a function call (directed) graph or cross ref. table
- Previous by thread: Heap reallocation
- Next by thread: GetScrollRange(, &maxpos) & GetScrollLimit()
- Index(es):
Relevant Pages
|