I use the random number generator for map creation, so if I want a 1
in 3 chance that a tree will be generated on a tile (instead of just
grass) and I have a 40 x 160 map, that's 6400 calculations in less
than a second. Even getting the milliseconds past midnight isn't
fast enough for that.
--- In beginnersroguelikedevelopment@yahoogroups.com, "allan175uk"
<allan@s...> wrote:
> I think you'd be better off just call srand() occasionally (or just
> once when your code starts).
>
> I tend to just call "srand(time(NULL))" near my program entry point
> and leave it at that, it seems pretty random to me! ;-)
>
> The last line (the return) is all you need really for a ranged
> random number.
>
> Also, even though PCs are getting faster & faster, calling time()
> once and GetTickCount() twice for *every* random number seems a bit
> excessive, especially as GetTickCount() will probably be returning
> the same number since the calls are only a few instructions apart!
>
> -----------
> Allan