Greetings,
If this question should be asked in a C language group instead of here, just
let me know and I will comply...
Here's my problem...
I am working on a small game in which the events will happen based
on a randomly generated number: 0 or 1. I use the following bit of
code to generate the number:
int get_rand_number(void) {
int i, chance = 0;
chance = 1+(int) (10.0*random()/(RAND_MAX+1.0));
// Example above taken from rand(3)
i = chance % 2;
printf("Chance: %d \n", i);
return i;
it seems to be kinda working. the problem is that whenever I run the program,Quote:}
I get the same results EVERYTIME... the same numbers (0 or 1) always come out
in the same order... right now, there is a for loop that calls the
get_rand_number() 10 times, and everytime I run the program, I get the
following results: 0 0 0 0 0 1 0 0 0 1
how can I "randomize" my results???
thanks
Martin