Re: Random number question?

From: Daniel Sjöblom (dsjoblom_at_mbnet.fi_NOSPAM)
Date: 06/21/04


Date: Mon, 21 Jun 2004 13:57:59 +0300

Paul Allen Panks wrote:
> How does HLA's random number generator differ from traditional BASIC's
> version? I've long based much of my adventure gaming on random numbers,
> especially during player/monster fighting. Does seeding a number truly
> make it random, or only quasi-random?

Pseudo-random is the term you are looking for. A PRNG is deterministic.
It will always output the same sequence of numbers for a given seed. If
you use a 'real' random seed, based on the computer clock for example,
you have a good chance of avoiding that problem. However, you shouldn't
choose a new seed everytime you want a new random number as it is
usually counterproductive. If you think about it, a clock is quite
predictable, after you know its initial value.

> Let's say I have a number between 1 and 35. What guarantee do I have that
> the computer won't habitually (or accidentally) pick the same range of
> numbers twice? Or the same individual number twice?

PRNGs are designed to have a period as long as possible, specifically to
avoid this. I find your question a bit strange though. If the RNG was
truly random it *would* pick the same numbers twice just as often as it
would pick two distinct numbers.

-- 
Daniel Sjöblom
Remove _NOSPAM to reply by mail