creating a random number within a desired range in Visual C ++. how? [random card] [random number]

admin / February 23rd, 2011/ Posted in Software / No Comments »

Q: I have a between 1 and 13 to generate. It is a dealing program. I tried to edge () method, but the stdlib library and when I entered the compiler said it couldnt find. What should I do?


EzDraw Random Number Picker Software.
Re:Originally posted by: guy
what does seed mean? initialize?
Yes. Pseudo generators take the initial value and use it to create all following values.

In CS a seed = starting / initial value or state, since future values or states "grow" out of it.


Phone Trace – Unlisted and Cell Numbers
Re:what does seed mean? initialize?

The Credit Card Debt Survival Guide
Re:stdlb is a C standard library not the C++ STL

In the friendly Books Online:

"The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand."

So:
1. seeding the generator — Books Online sample code shows you how to do this using the time function

2. limiting values to a range. Hmmm, what does % do? (Hint 2: then add +1)


Bingo Card Creator.
Re:ok. i guess for some reason stdlib.h worked. however. when i say
cout << rand() it keeps showing 41. How can i give it parameters like between 1 and 13? I believe its RAND_MAX….
thanks

The Power of Numbers (44 Page Manual).
Re:no
#include <stdlib>
using namespace std;

Number Focus
Re:are you including like this

#include <stdlib.h>


Related posts


Tags: ,

Leave a Reply

Name required

Mail (will not be published) required

Website