Is it possible to assign the value generated from srand()
to a variable??
Cheers
Is it possible to assign the value generated from srand()
to a variable??
Cheers
yes.
Or many variations of that, depending on your code...Code:srand(); int x = rand();
Last edited by fry; 10-03-2002 at 04:41 AM.
IDE: Dev C++ 5
Lib: Allegro
OS: Windows 2000
All srand() does is seed the random numbers you later produce with rand()...it returns void, so you cant assign its return to anything.
Might I suggest this
<edit> Ahh...!.....I saw you change that fry ....Also, srand takes a parameter.....</edit>
thanks guys,
but what about if you have several srands() in your program
and you want to assign them to different variables??
sorry to be a pain.
cheers
You only need to srand() once, i believe.
IDE: Dev C++ 5
Lib: Allegro
OS: Windows 2000
What i ment was, i am going to generate several random numbers
and i needed to assign them to indivdual variables.
can anyone help please
thanks in advance
aha sorted it out now!!
just goes to show if you play about abit with your code
you can get it to work!!
Thanks to the above people for your help........
Playing around with your code is the most effective way to learn what you can and can't do
Always try stuff yourself before asking others, you will learn a great deal more!
IDE: Dev C++ 5
Lib: Allegro
OS: Windows 2000