Graeme wrote:
>
> I am writing a simple windows matching game with cards and pictures
> (ie "concentration"). In order to write something like this, I need
> to be able to give each "card" a random position in the assortment,
> and I need the assortment to be different each time the program is
> run. (I think) This means I need to be able to generate as many
> random numbers at once as the number of "cards" in the assortment when
> the program is first loaded. I have tried seeding the rand() function
> with GetTickCount() as well as time():
>
> srand(GetTickCount());
>
> but the loop that generates the numbers is executed too fast, and I
> end up getting 36 identical numbers.
I am pretty sure you made a common newbie mistake:
You called srand() every time before you called rand().
Don't do that! Call srand only once, eg. when your program starts
up.
--
Karl Heinz Buchegger