Jump to content


Tim's Random Number Generator

  • Please log in to reply
No replies to this topic

#1 Timmeh


    GMC Member

  • New Member
  • 358 posts

Posted 22 February 2008 - 01:51 AM

Tim's Pseudo-Random Number Generator

Generates Pseudo-Random Numbers from seeds, generate from multiple seeds

GM Version: GM7 Pro

Extension Version: 1.10

File Type: .zip, contains extension and PDF help file.

File Size: 152kb (~154,960-155,648 bytes)

Download: 64Digits, Ripway

Description: Allows the creation of multiple random number generation systems, each with their own seed. I decided to make it when I realized the limitations of the built in random number generator. Specifically that even when seeded manually it is not perfectly predictable and that you can only have one system. By the former I mean that because GM uses it's own random number generator, sometimes even when seeded manually it will seem to skip a number when it uses it internally. The latter requires a bit more explanation. Say you were making a random dungeon generator. You could generate all the flooring, then the walls, then the items, etc. But you would have to do one, reseed the generator, do the next, and repeat. With multiple systems you can do all tasks at the same time.

Why Pseudo-Random? Why not actual random numbers?
Well, for the most part, because so far as I know, literal numbers are impossible to generate on a computer. Every game in existence (that I know of, correct me, with a source, if I'm wrong), uses pseudo-random numbers. GMs built in generator is pseudo-random.

Okay then, why should I use this instead of the one built into GM, aren't they the same?
Well, yes and no. They are both pseudo-random, but mine can handle multiple sets and can be used more precisely than GM's. In other words, because GM uses it's own random number generator internally, sometimes even when seeded manually it will seem to skip a number when it uses it internally. Also, if you try to use GM's for multiple things at the same time, you will typically not be able to re-create the string of numbers, even with the same seed.

Sounds good, whats the catch?
None really. It's free. Simple. Comes with a manual and in-depth walk through of the inner workings, and can be used in commercial games. The only requirement in that you give me credit, and only that in commercial games!

Wait, what's this about the inner workings?
In the help file I have included details on how the engine works, so that you can adjust and edit it to fit your own needs. I have also included the algorithms used to generate the numbers.

UPDATE v1.10:
Changed default numbers in the algorithm to increase the quality of the randomness.
Updated help file and extension appropriately.

Edited by Timmeh, 27 February 2008 - 01:08 AM.

  • 0
I have started teaching myself C++, and do not use Game Maker regularly any more. You can follow my current project either on my DevBlog or in my topic on the Bay12 forums.


LINKS: My Script Collection - My Autotile Script - My Random Number Generator - My Process Runner Extension - My Detailed TDS Tutorial