Latest Uploads
Invasion V ... prototype

rychan

Invasion V ... Prototype

rychan

Shields 64x64

Pakz

Ffs_Spam

Jayenkai

Hives Screen shot

rychan

Rpg Potion Sprites

Pakz

Showcase > Functions Libraries ( Created 16 August 2008 | Last Edited 21 December 2008)

Mersenne Twister Random Number Userlib - Created by Evil Roy Ferguson (Rating 100%)

Use Mersenne Twister to generate random numbers.
Created using Blitz > WindowsView Worklog (0 entries)
mtrandom.zip
A DLL wrapper around Mersenne Twister random number generator and a userlib for Blitz3D/Plus.

Unzip it to your userlibs folder, and distribute mtrandom.dll with your program. It's 15KB, which shouldn't be too huge.

Benefits over the default Blitz generator include very slightly faster speed, better distribution of random numbers, and consistency in generated numbers across computers.

Functions available are mtSeedRnd(), mtRand(), mtRnd(), and mtRawRand().

mtSeedRnd(seed) works as expected.
mtRand(min, max) works as Rand(), but both min and max must be specified.
mtRandMod(min, max) is mtRand() from the previous version. Its distribution is not quite as good, and it barfs if min > max, but it is minutely faster (about 5ms over 50000 calls).
mtRnd() is the oddball - it always returns a result in the range [0, 1]. To simulate Blitz's Rnd() behavior, try (min + mtRnd() * Float(max-min)).
mtRawRand() returns a random number in [-2,147,483,648, 2,147,483,647].
Recent Updates

.02 - mtRand() replaced with a version with better distribution that handles min>max (check was originally omitted for performance reasons, but it turns out that it's almost entirely negligible). For programs relying on the old behavior, use mtRandMod.
.01 - Initial upload.

Latest Comments

Posted : Saturday, 16 August 2008, 17:24
Jayenkai


Vote : 5
Cool.

Will be extremely useful when sticking with a pseudo random set of numbers!

Homepage : http://AGameAWeek.com
Posted : Saturday, 16 August 2008, 18:24
mindstorm8191


Cool stuff. BlitzMax has been needing a proper random number generator for quite some time.

Homepage : http://vesuvius.ismywebsite.com
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 650|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Latest Posts
Any Feature Requests?
Kuron Fri 23:09
More Monkey Madness - With Ducks
therevillsgames Fri 20:23
Arms on Switch
Jayenkai Fri 18:30
Time for a new Android Test Doohickey
Jayenkai Fri 09:26
CSS-Me-Do - SoCoder2
Jayenkai Fri 06:28
Pillowcases for kids!
rockford Thu 16:15
Manchester Arena Explosion
Jayenkai Thu 02:04
Buy Zelda
spinal Wed 11:31
Family
Jayenkai Wed 04:06
RIP - Sir Roger Moore
rockford Tue 15:56
More

Latest Items
Showcase : Hives
zzoom Fri 16:10
Dev-Diary : My Journey into NES Development
rychan Thu 12:31
Showcase : Flappadiddle
Jayenkai Sun 14:39
Snippet : QFind
Jayenkai Sun 13:02
Showcase : Tiny Blocks
Jayenkai Sun 04:08
Showcase : Read Error A
rychan Fri 05:13
Blog : All my makes!
Jayenkai Tue 05:48
Showcase : Infinitron
rychan Mon 18:03
Showcase : Quadoban
rskgames Fri 10:11
Blog : My Arduino experience.
steve_ancell Wed 17:02
Showcase : Roguelike Explorer
Pakz Fri 06:59
News : Newsletter #311
Jayenkai Thu 17:27
Link : Super Shapes Exploration Kit
Andy_A Thu 11:09
Dev-Diary : Sensitive - Arduboy!
rychan Thu 17:27
Snippet : Skylines
steve_ancell Tue 14:25
More

Who's Online
Jayenkai
Sat, at 01:56
therevillsgames
Sat, at 00:49
Kuron
Fri, at 23:09
Evil Roy Ferguson
Fri, at 20:47
rskgames
Fri, at 19:28
9572AD
Fri, at 18:10
steve_ancell
Fri, at 18:04
rockford
Fri, at 16:34
zzoom
Fri, at 16:14
Pakz
Fri, at 15:20
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.