I've posted my revised C++ implementation of the Mersenne Twister at: http://www.coyotegulch.com/libcoyote...istedRoad.html
This is "free-as-in-liberty" and "free-as-in-beer" code.
The Mersenne Twister is a "random number" generator invented by Makoto
Matsumoto and Takuji Nishimura; their website includes numerous
implementations of the algorithm.
Essentially, the Mersenne Twister is a very large linear-feedback shift
register. The algorithm operates on a 19,937 bit seed, stored in an
624-element array of 32-bit unsigned integers. The value 2^19937-1 is a
Mersenne prime; the technique for manipulating the seed is based on an
older "twisting" algorithm -- hence the name "Mersenne Twister".
An appealing aspect of the Mersenne Twister is its use of binary
operations -- as opposed to time-consuming multiplication -- for
generating numbers. The algorithm also has a very long period, and good
granularity. It is both fast and effective for non-cryptographic
applications.
--
Scott Robert Ladd
Coyote Gulch Productions ( http://www.coyotegulch.com)
Software Invention for High-Performance Computing
Jul 22 '05
31 4447
> A random number generator that does not generate uniformly distributed numbers is of very questionable use.
Not at all. I could have a random number generator returning doubles that
generates a random number between 0 and 1 with a Normal distribution, mean
0.5, standard deviation 1. I can think of a use for that. I can think of
other non-uniform random number generator distributions, all statistical
that are of use.
Your mathematical credentials are suspect. You seem to be way more
incompetent than the OP.
Stephen Howe
"Stephen Howe" <NO**********@d ial.pipex.com> wrote in message
news:3f******** *************** @reading.news.p ipex.net... A random number generator that does not generate uniformly distributed numbers is of very questionable use.
Not at all. I could have a random number generator returning doubles that generates a random number between 0 and 1 with a Normal distribution, mean 0.5, standard deviation 1. I can think of a use for that. I can think of other non-uniform random number generator distributions, all statistical that are of use.
Your mathematical credentials are suspect. You seem to be way more incompetent than the OP.
Stephen Howe
A normal distribution has infinite range. So, generating random numbers
between 0 and 1 with a Normal distribution doesn't make sense.
Yes, you can have a truncated Normal distribution, but that is not what you
are writing.
I'm well aware that there are non-uniform random number distributions. In
the fall I corrected two errors in Knuth's Vol. 2 about non-uniform RNG. I
have the check to prove it.
I commented about the code which is intended to generate a uniform
distribution. I doesn't as others have pointed out.
As for my credentials, I have a Ph.D. in Mathematics (Penn State '89).
Carsten Hansen
> A normal distribution has infinite range. So, generating random numbers between 0 and 1 with a Normal distribution doesn't make sense.
It does if you are returning cumulative probabilites. So
_ x
|
p(x) = 1.0 / (sqrt (2.0 * pi))I exp(- (x * x) / 2.0)
_I
-Inf
That will lie between 0.0 and 1.0.
Stephen Howe
"Stephen Howe" <NO**********@d ial.pipex.com> wrote in message
news:3f******** *************** @news.dial.pipe x.com... A normal distribution has infinite range. So, generating random numbers between 0 and 1 with a Normal distribution doesn't make sense.
It does if you are returning cumulative probabilites. So
_ x | p(x) = 1.0 / (sqrt (2.0 * pi))I exp(- (x * x) / 2.0) _I -Inf
That will lie between 0.0 and 1.0.
Stephen Howe
That is not a distribution. That is a probability. You don't generate that.
You calculate that.
You talked about generating random numbers between 0 and 1 with a Normal
distribution.
Now you are changing it to cumulative probabilities. Something very
different.
But nice try. Maybe you will get partial credit.
Carsten Hansen
"Carsten Hansen" <ha******@world net.att.net> wrote in message
news:4G******** ***********@bgt nsc05-news.ops.worldn et.att.net... "Stephen Howe" <NO**********@d ial.pipex.com> wrote in message news:3f******** *************** @news.dial.pipe x.com... A normal distribution has infinite range. So, generating random
numbers between 0 and 1 with a Normal distribution doesn't make sense. It does if you are returning cumulative probabilites. So
_ x | p(x) = 1.0 / (sqrt (2.0 * pi))I exp(- (x * x) / 2.0) _I -Inf
That will lie between 0.0 and 1.0.
Stephen Howe
That is not a distribution. That is a probability. You don't generate
that. You calculate that.
IMHO you also "calculate" numbers following a distribution, don´t you? I
mean we´re talking about distributions given in analytical form and not some
stochastic processes.
You talked about generating random numbers between 0 and 1 with a Normal distribution. Now you are changing it to cumulative probabilities. Something very different.
To be exact he is talking about cumulative distributions (CDF) and not
cumulative probabilities, though in principle you are right as the
discussion is about PDF and not CDF.
But nice try. Maybe you will get partial credit.
Thanks :-) But don´t you think that this discussion will lead to nowhere and
that comp.lang.c++ might not be the place to discuss statistical issues?
Regards
Chris
"Chris Theis" <Ch************ *@nospam.cern.c h> wrote in message
news:vK******** *************@n ews.chello.at.. . "Carsten Hansen" <ha******@world net.att.net> wrote in message news:4G******** ***********@bgt nsc05-news.ops.worldn et.att.net... "Stephen Howe" <NO**********@d ial.pipex.com> wrote in message news:3f******** *************** @news.dial.pipe x.com... > A normal distribution has infinite range. So, generating random numbers > between 0 and 1 with a Normal distribution doesn't make sense.
It does if you are returning cumulative probabilites. So
_ x | p(x) = 1.0 / (sqrt (2.0 * pi))I exp(- (x * x) / 2.0) _I -Inf
That will lie between 0.0 and 1.0.
Stephen Howe
That is not a distribution. That is a probability. You don't generate that. You calculate that.
IMHO you also "calculate" numbers following a distribution, don´t you? I mean we´re talking about distributions given in analytical form and not
some stochastic processes.
You talked about generating random numbers between 0 and 1 with a Normal distribution. Now you are changing it to cumulative probabilities. Something very different.
To be exact he is talking about cumulative distributions (CDF) and not cumulative probabilities, though in principle you are right as the discussion is about PDF and not CDF.
But nice try. Maybe you will get partial credit. Thanks :-) But don´t you think that this discussion will lead to nowhere
and that comp.lang.c++ might not be the place to discuss statistical issues?
Regards Chris
Generating random numbers with a given distribution has a well-established
meaning. Generating random numbers with a Normal distribution between 0 and
1 doesn't makes sense. I'm not supposed to correct that?
Carsten Hansen
"Carsten Hansen" <ha******@world net.att.net> wrote in message
news:mPRKb.2745 $Ub6.81689@bgtn sc04-
[SNIP] Generating random numbers with a given distribution has a well-established meaning. Generating random numbers with a Normal distribution between 0
and 1 doesn't makes sense. I'm not supposed to correct that?
Carsten Hansen
Hi Carsten,
relax :-) Of course you should correct wrong statements, this is the way
that people reading these postings are supposed to obtain wider & better
knowledge. However, I wouldn´t be so quick to say that generating a normal
distribution between 0 & 1 (Stephen proposed a mean value of 0.5) doesn´t
make sense. If you want to study for example a special case of a biased
Wiener-Levy process you might resort to such random numbers (whether this
study makes any sense or not is a different thing!).
Chris
"Chris Theis" <Ch************ *@nospam.cern.c h> wrote in message
news:jj******** *******@news.ch ello.at... "Carsten Hansen" <ha******@world net.att.net> wrote in message news:mPRKb.2745 $Ub6.81689@bgtn sc04- [SNIP] Generating random numbers with a given distribution has a
well-established meaning. Generating random numbers with a Normal distribution between 0
and 1 doesn't makes sense. I'm not supposed to correct that?
Carsten Hansen
Hi Carsten,
relax :-) Of course you should correct wrong statements, this is the way that people reading these postings are supposed to obtain wider & better knowledge. However, I wouldn´t be so quick to say that generating a normal distribution between 0 & 1 (Stephen proposed a mean value of 0.5) doesn´t make sense. If you want to study for example a special case of a biased Wiener-Levy process you might resort to such random numbers (whether this study makes any sense or not is a different thing!).
Chris
Generating random numbers with a given distribution has a well-established
meaning.
Using that well-established meaning and given that a Normal distribution has
an infinite range, it does not make sense to talk about generating random
numbers with a Normal distribution between 0 and 1.
You can calculate other things. But if you use a well-established phrase,
you better qualify it.
That is all I'm saying.
Carsten Hansen
Carsten Hansen writes: Generating random numbers with a given distribution has a well-established meaning. Using that well-established meaning and given that a Normal distribution
has an infinite range, it does not make sense to talk about generating random numbers with a Normal distribution between 0 and 1. You can calculate other things. But if you use a well-established phrase, you better qualify it.
I read Ladd's whole post as "good enough for government work". If I had
seen a similar thing in some high-falutin' mathematics journal, I would have
applied different standards. After all, the computers I have seen have
been unable to express infinity in a reasonable fashion, anyway, one of the
popular OSes limits RAM to only 2^29 bytes. Computers of the kind being
discussed here (that is, a machine, not a human) deal with approximations
for the real numbers encountered in the field of mathematics. C++, as used
here, does not deal with symbolic mathematics.
I saw, and see, no reason for further qualification as to the use of the
phrase, considering the context in which it was provided.
It is pretty clear that you are the kind of person that has to have the last
word. So post it, I don't expect to express any answer.
"kevin collins" <ke********@hot mail.com> wrote in message
news:pXTKb.7668 83$Tr4.2203330@ attbi_s03... Carsten Hansen writes:
Generating random numbers with a given distribution has a
well-established meaning. Using that well-established meaning and given that a Normal distribution has an infinite range, it does not make sense to talk about generating
random numbers with a Normal distribution between 0 and 1. You can calculate other things. But if you use a well-established
phrase, you better qualify it.
I read Ladd's whole post as "good enough for government work". If I had seen a similar thing in some high-falutin' mathematics journal, I would
have applied different standards. After all, the computers I have seen have been unable to express infinity in a reasonable fashion, anyway, one of
the popular OSes limits RAM to only 2^29 bytes. Computers of the kind being discussed here (that is, a machine, not a human) deal with approximations for the real numbers encountered in the field of mathematics. C++, as
used here, does not deal with symbolic mathematics.
I saw, and see, no reason for further qualification as to the use of the phrase, considering the context in which it was provided.
It is pretty clear that you are the kind of person that has to have the
last word. So post it, I don't expect to express any answer.
This has nothing to do with how big a number you can represent on a
computer. When you have an infinite range and you claim it falls between 0
and 1 you are talking nonsense.
Carsten Hansen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raymond Hettinger |
last post by:
Based on your extensive feedback, PEP 322 has been completely revised.
The response was strongly positive, but almost everyone preferred
having a function instead of multiple object methods. The updated
proposal is at:
www.python.org/peps/pep-0322.html
In a nutshell, it proposes a builtin function that greatly simplifies reverse
iteration. The core concept is that clarity comes from specifying a
sequence in a forward direction and...
|
by: Shufen |
last post by:
Hi,
I'm a newbie that just started to learn python, html and etc. I have
some questions to ask and hope that someone can help me on.
I'm trying to code a python script (with HTML) to get values from a
html form that consists of about 10 checkbox and a textbox where user
have to key in a value to perform a search.
From python tutors, I learned that I have to use the following method:
|
by: Jan Roland Eriksson |
last post by:
I'm posting a revised version of the meta FAQ for this NG.
Beware that there are a few links in there that does not have a resource
available for them yet but, over and all, this following document should
be usable as presented.
Rip it apart at your own discretion...
=====
Archive-name: www/stylesheets/newsgroup-faq
|
by: Martin Ho |
last post by:
Hi Everyone,
I have this code of Mersenne twister, which produces the random
numbers, one of the fastest codes as far as I know to produce random
numbers.
Anyways, it's writen in c# and I need to translate it to vb.net.
I tried some translators and I can't get it to work.
Could someone help me?
This is the code:
|
by: CBFalconer |
last post by:
I have modified my ggets utility, to simplify the code and reduce
the requirements on the standard library. The external action is
totally unchanged, so there is no real need for anyone to upgrade.
Available at:
<http://cbfalconer.home.att.net/download/>
--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@maineline.net)
Available for consulting/temporary embedded and systems.
| |
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 420 open ( +4) / 3410 closed ( +2) / 3830 total ( +6)
Bugs : 915 open (+17) / 6186 closed ( +6) / 7101 total (+23)
RFE : 235 open ( +1) / 238 closed ( +0) / 473 total ( +1)
New / Reopened Patches
______________________
|
by: Simon |
last post by:
I have a quick question on the Mersenne Twister (hereinafter MT)
I'm using the standard C code downloaded from the MT website
(http://tinyurl.com/6d8t3). It's being used for a game to generate
random levels, monsters, items and so on, and I want the game to be
different each time I play it.
The standard MT code gives me the same string of random numbers each
time I run it. This is not surprising - computers are deterministic
and it...
|
by: bearophileHUGS |
last post by:
This may be interesting for Python developers of the random module,
"SIMD-oriented Fast Mersenne Twister (SFMT): twice faster than
Mersenne Twister":
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
One function may be useful to generate integers (randint, randrange,
choice, shuffle, etc), the other for floating point values (random)
faster than the current Mersenne Twister used in the random module.
|
by: mjm2114 |
last post by:
Hi there,
I have a question on a naive implementation of a parallel MT that I've
done using the fortran version of MT19937ar.f posted in Prof.
Matsumoto's website. (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/
MT2002/emt19937ar.html)
First, I setup a KISS RNG (Marsaglia, 1999)
in the master node and seed it. I then use the first 4 outputs from
the master node to
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |