Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Miscellaneous
»
Suggestions
»
Replace Mersenne Twister PRNG?
Free Pascal
Website
Downloads
Wiki
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Bugtracker
IRC channel
Latest SVN
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Verify existence of a var...
by
MarkMLl
[
Today
at 03:16:04 pm]
reading from out of array...
by
Zvoni
[
Today
at 03:14:11 pm]
Getting basic state-depen...
by
heebiejeebies
[
Today
at 03:08:22 pm]
Arduino zero level.
by
Seenkao
[
Today
at 03:04:30 pm]
Basic question about clas...
by
Martin_fr
[
Today
at 03:01:06 pm]
Broken file dialogs on Wi...
by
CCRDude
[
Today
at 03:00:14 pm]
TOpenDialog.Execute crash...
by
Relativity
[
Today
at 02:58:45 pm]
VirtualTreeView Hover ove...
by
Weitentaaal
[
Today
at 02:49:20 pm]
Odd way of calculating th...
by
Salazar
[
Today
at 02:33:13 pm]
[SOLVED] IsNan(double) gi...
by
wp
[
Today
at 02:31:41 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Replace Mersenne Twister PRNG? (Read 1390 times)
segfault
Full Member
Posts: 107
Replace Mersenne Twister PRNG?
«
on:
April 27, 2020, 10:28:59 am »
FP currently uses the Mersenne Twister random number generator, which although commonly used, has disadvantages :
https://en.wikipedia.org/wiki/Mersenne_Twister#Disadvantages
A suggested alternative is the ACORN family of PRNG's, which is apparently easy to code, fast, and has better statistical properties than the Mersenne twister (it passes the tests which twister fails).
Wiki page :
https://en.wikipedia.org/wiki/ACORN_(PRNG
)
Also the authors web site :
http://acorn.wikramaratna.org/index.html
Note : it's not cryptographically secure, but neither is the twister.
«
Last Edit: April 27, 2020, 10:31:00 am by segfault
»
Logged
Thaddy
Hero Member
Posts: 10749
Re: Replace Mersenne Twister PRNG?
«
Reply #1 on:
April 27, 2020, 12:17:01 pm »
There already many alternatives (see the wiki) but if I can find C sources I will add it, depending on licensing,
ETA
The period is rather low compared to others. I wonder if it really adds something.
https://wiki.freepascal.org/Marsaglia%27s_pseudo_random_number_generators
(these are really fast). I added tests fror correctness.
https://wiki.freepascal.org/Delphi_compatible_LCG_Random
https://wiki.freepascal.org/Dev_random
Note that FPC is not likely to change its default random because it would break existing code and data.
Same goes for Delphi, therefor I added a Delphi compatible LCG to the wiki to be able to work with Delphi generated data.
Note I already have a pluggable framework like C++, but I need to verify some modules. Comes later this year.
«
Last Edit: April 27, 2020, 12:51:02 pm by Thaddy
»
Logged
BeniBela
Hero Member
Posts: 788
Re: Replace Mersenne Twister PRNG?
«
Reply #2 on:
April 27, 2020, 12:50:13 pm »
I have implemented xoshiro**:
https://github.com/benibela/internettools/blob/master/data/xquery.internals.rng.pas
The inventor of this prng claims it is faster than others
Logged
https://www.benibela.de/index_en.html
https://github.com/benibela
Thaddy
Hero Member
Posts: 10749
Re: Replace Mersenne Twister PRNG?
«
Reply #3 on:
April 27, 2020, 12:54:09 pm »
Have have implemented that too (128). It is faster than most with nice properties.
It also belongs to the Marsalia family in the sense that it uses the same concepts: it derives from xorshift.
I may add it to the Marsalia article.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Miscellaneous
»
Suggestions
»
Replace Mersenne Twister PRNG?
TinyPortal
© 2005-2018