Do you mean that you get the same sequence of numbers over consecutive
runs of your mod? If so, that is the expected behavior.  Low-level
random number generators are typically deterministic functions.  If you
want them to give you different values each time you run you need to set
them up with different initial conditions.  The initial conditions are
usually (and definitely in our case) set using a single value called a
seed.  A typical way to make this non-deterministic is by taking a
sample of the system clock and using it as the seed for the random
number generator.

E.g.

#include <time.h>

RandomSeed( (int)time(NULL) );

Jay


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Mark Gornall
> Sent: Friday, March 21, 2008 3:40 AM
> To: hlcoders@list.valvesoftware.com
> Subject: [hlcoders] randomness
> 
> Hi,
>   I'm using the Advanced SDK, Ep1 edition and I seem to be 
> having real trouble getting radomness in the random numbers. 
> I can see that there is code there for predicted/shared 
> randoms, but I'm just using RandomFloat or 
> random->RandomFloat but it seems to always give the same 
> numbers. Anyone
> know why that would be? Am I doing it wrong?
> 
> Thanks,
> Mark.
> 
> 
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list 
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> 
> 

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to