rand and srand
- From: "Bill Cunningham" <nospam@xxxxxxxxx>
- Date: Sun, 09 Mar 2008 20:47:19 GMT
I am stumped on this one. I tried two methods and something just doesn't
seem right. I'll try my new syle.
#include <stdio.h>
#include <stdlib.h>
main() {
srand(2000); /*seed unsigned */
printf("%u",rand());
}
Now I get a number much larger than 2000. Also when I also try RAND_MAX with
srand from time to time.
With main I was always told int was the default type and didn't need to be
declared. Main() has always worked. I hope this code is much more readable.
Bill
.
- Follow-Ups:
- Re: rand and srand
- From: Mark McIntyre
- Re: rand and srand
- From: Keith Thompson
- Re: rand and srand
- From: santosh
- Re: rand and srand
- From: Falcon Kirtaran
- Re: rand and srand
- Prev by Date: Re: What could the compiler be possibly complaining about
- Next by Date: Re: OK folks, corrected
- Previous by thread: a bit of a puzzle
- Next by thread: Re: rand and srand
- Index(es):