iRandom = Int(Rnd * 50) + 1
Lee Weiner
weiner AT fuse DOT net
Reply by email would be much appreciated
Andrew
>How random are the so called random numbers generated from a computer
>using any of the programming languages.
Not very. They are actualy called 'psudo random numbers', as they are
mathematicaly generated from the previous number, called the seed.
VB's randomize function will set the seed acording to the clock,
making them unpredictable enough for most pourpeses, but not for
cryptography.
/---------------------------------------------\
|Barney Laurance bar...@redmagic.dircon.co.uk |
|www.redmagic.dircon.co.uk/barney/ |
\---------------------------------------------/
> How random are the so called random numbers generated from a computer
> using any of the programming languages. Doesn't the computers design
It varies.
> affect the "randomness" because the whole esence of a computer is to
> be structured and organised. Isn't the part of the computer that
> contains "numbers" already organised in such a way that it affects the
> "randomness" of those numbers???
Perhaps, but there are plenty of sources of true randomness, especially
if you have a sound card or are connected to a LAN. Anyway, this sort
of thing is discussed in detail in any good algorithms book.
--
Joe Foster <mailto:jfo...@ricochet.net> Spam is irrelevant. Assimilate this:
<ftp://ftp.microsoft.com/softlib/index.txt> Microsoft's master patch list
<ftp://ftp.microsoft.com/softlib/mslfiles/> MS I got yer patch right here!
<http://www.microsoft.com/msdn/> MS Knowledge Base & more
<http://www.dejanews.com/home_ps.shtml> Usenet search and archival engine
<http://www.altavista.digital.com> WWW *and* Usenet search engine
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!
Mark Gregory
Andrew wrote in message <35f152b2...@news.pipemedia.net>...
>How random are the so called random numbers generated from a computer
>using any of the programming languages. Doesn't the computers design
>affect the "randomness" because the whole esence of a computer is to
>be structured and organised. Isn't the part of the computer that
>contains "numbers" already organised in such a way that it affects the
>"randomness" of those numbers???
>
Andrew wrote:
> How random are the so called random numbers generated from a computer
> using any of the programming languages. Doesn't the computers design
> affect the "randomness" because the whole esence of a computer is to
> be structured and organised. Isn't the part of the computer that
> contains "numbers" already organised in such a way that it affects the
> "randomness" of those numbers???
>
> Reply by email would be much appreciated
>
> Andrew
As some respondents have noted, random numbers are really pseudo-random,
not perfectly random in the strictest mathematical sense. However, what
degree of "accuracy" do you need? I'm developing an application that,
among other things, generates a "random" path for stock prices, given a
few parameters entered by the user (a trend term, a volatility
term,etc.). Calculating the path requires numerous "drawings" of a random
number drawn from a standard normal distribution. From the equation
governing the path, the theoretical expected value and variance of the
final point can be derived. The program generates a large number of
paths, collects the final results, calculates the empirically observed
mean and variance, and compares them to the theoretical mean and
variance. It also calculates 90% theoretical confidence intervals, and
counts the frequency with which the generated paths actually end up within
those intervals. The "goodness" of the empirical results (how close they
are to the theoretically predicted results) depends solely on VB's random
number generator (and, or course, the number of sample paths). If I
generate 1000 sample paths, and the theoretical expected value of the
stock price is 50, the empirical mean typically turns out to be something
like 50.1, 49.9, etc, and often much better. Something like 90.1 or 89.9%
(or better) of the paths really do wind up within the 90% theoretical
confidence intervals. Moreover, with 100,000 paths the results are much,
much better. For my purposes, that is more than good enough. But I could
imagine applications for which VB's random number generator might not be
adequate. All depends on how good "good" has to be!
certain deterministic mathematical systems (which can therefore be
implemented by a computer) give rise to "chaos" - they are nonperiodic and
a small change in the initial parameters of the system can give rise to
important changes in the state after a certain period of time.
If you wanna try one of these out try plotting the graph of a sequence
whose first term is, say, .54321 and whose nth term 2x² - 1 where x is the
(n-1)th term. You can try
kx² - 1 for other values of k as well. VB probably looks to some adress in
ram for the equivalent of .54321 - called the random seed - which starts
the whole thing off. Whatever happens to be in that adress is used.
see ya from francis :-)
There is a tremendous literature on this topic; you can look in any
numerical analysis text, or just search the www for "pseudorandom" ... I got
3564 hits on Yahoo! just now.
BTW, this type of algorithm is extremely fast: just multiply, add, shift,
and you're done!
Best Regards, Peter
Francis Woolfe wrote in message <01ba7e11$51d27200$7315eec3@default>...