Difference between revisions of "RandomLua"

(RandomLua Library)
 
m (Added: Other Languages)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
math.random give different numbers on different platforms.
+
math.random used to give different numbers on different platforms.
Since I don't intend to compile C code for every platform, I decided to create a Pure Lua Random Generator (probably another one...).
+
Since I didn't intend to compile C code for every platform, I decided to create a Pure Lua Random Generator (probably another one...).
 +
 
 +
This is not true anymore, but the library still remains for the curious and those who want to try different pseudo-random generators.
  
 
3 algorithms:
 
3 algorithms:
* Mersenne twister [http://en.wikipedia.org/wiki/Mersenne_twister], very good and slow
+
* Mersenne twister [http://en.wikipedia.org/wiki/Mersenne_twister], very good and slow.
* Multiply-with-carry [http://en.wikipedia.org/wiki/Multiply-with-carry], probably the best option
+
* Multiply-with-carry [http://en.wikipedia.org/wiki/Multiply-with-carry], probably the best option.
 
* Linear congruential generator [http://en.wikipedia.org/wiki/Linear_congruential_generator], fast and, well, it works... kind of.
 
* Linear congruential generator [http://en.wikipedia.org/wiki/Linear_congruential_generator], fast and, well, it works... kind of.
MWC and LGC come with 3 pre-defined parameters.
+
MWC and LCG come with 3 pre-defined parameters.
  
Download: [http://love2d.org/forums/viewtopic.php?f=5&t=3424 Original Thread]
+
[http://love2d.org/forums/viewtopic.php?f=5&t=3424 Original Thread]
 +
[https://github.com/linux-man/randomlua Download]
  
{{#set:LOVE Version=0.7.2}}
+
{{#set:LOVE Version=Any}}
 
{{#set:Description= Random numbers generator for all platforms}}
 
{{#set:Description= Random numbers generator for all platforms}}
 +
{{#set:Keyword=Math}}
 
[[Category:Libraries]]
 
[[Category:Libraries]]
 +
== Other Languages ==
 +
{{i18n|RandomLua}}

Latest revision as of 15:36, 15 December 2019

math.random used to give different numbers on different platforms. Since I didn't intend to compile C code for every platform, I decided to create a Pure Lua Random Generator (probably another one...).

This is not true anymore, but the library still remains for the curious and those who want to try different pseudo-random generators.

3 algorithms:

  • Mersenne twister [1], very good and slow.
  • Multiply-with-carry [2], probably the best option.
  • Linear congruential generator [3], fast and, well, it works... kind of.

MWC and LCG come with 3 pre-defined parameters.

Original Thread Download

Other Languages