[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Random (Was: Cannot run KDE snapshot :()
From:       Waldo Bastian <bastian () suse ! de>
Date:       1999-12-10 9:50:16
[Download RAW message or body]

On Fri, 10 Dec 1999, Bo Thorsen wrote:
ndom numbers.
> 
> If you want to make the class KSequence, I think you should rename it to
> KRandom. This could then have static to give you an integer, float etc.
> and there would be no distinction between having one random number and
> having a sequence of random numbers. I think it will be a cause of
> confusion if there is this distinction and even more so, if the random
> method is not even in the same class. It strikes me as very bad design.

No. You miss the point.

There are two different things which are both reffered to as "random
number".

You have:
1) A totally unpredictable number.
2) A reproducable sequence of numbers with no appearant correlation.

For games and statistical analysis you need 2). This means that you can
reproduce the game or simulation if you start with the same seed.

For security related stuff you need 1.

An easy, but not very good, way to make 1) is to take e.g. the time and
use this as seed for 2). And then use a number returned by method 2).
A better way would be to use e.g. /dev/random on linux. See the
man-page for details.

1) and 2) are very different concepts and serve completely different
purposes. It is the lack of differentation between the two that causes
a lot of confusion. That's why this class should be called KSequence
and not KRandom: To emphasize these differences.

Cheers,
Waldo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic