Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Shared Code / Re: Random Number Generator on: 2012-10-25 00:06:51
You can't just change ops around willy-nilly.

I took over because I wrote the RNG and to be fair the OP shouldn't have posted it because he knew none of the theory behind it so I came in to answer and clarify things for some of the posters.

As for the period as you said it is 2^64 - 1 (Maximal) which is why I chose these numbers. As for the statistical properties, I didn't realise that different choices in numbers could effect it. I will have to read up and better understand all these properties. As for now, I will change the values to your last suggested ones and have the OP correct it in the code.

Edit: I'm not having a go at the OP there he is trying to do the right thing by the community and provide you guys with some working code =)
2  Game Development / Shared Code / Re: Random Number Generator on: 2012-10-24 02:49:54
How much randomness do you get out of such a system? It does not look like it would work very well. Is it based on an existing rng scheme?

It's an XORShift RNG (A subset of a Linear Feedback Shift Register [LFSR]) . The system is extremely fast at generating pseudo-random numbers and has been in use for a long time. The numbers that are being used for the shifts aren't just off the top of your head. They are picked to create a maximal 64 bits shift register (63 bits are caused from the absolute function, effectively doubling up the numbers that can be returned therefore halving the actual variation in numbers returned).

With LFSRs the sequence of numbers will eventually repeat. To be maximal means every single combination of bits (apart from the all zeroes) will appear before the sequence repeats. This means there are a total 9,223,372,036,854,775,808 numbers in a 64-bit LFSR that will appear before the sequence repeats itself when using a maximal sequence.

This system can be "cracked" with a given sample size so you wouldn't use it alone in a security system but there are security algorithms based off it.

However for the sake of games programming, 99 times out of 100 your random number generator doesn't need to be secure.

If you want more information there is plenty of information on the topic all over Google.

I hope this enlightens some of you who haven't seen this type of RNG before.

Matt.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (54 views)
2014-11-26 15:22:04

toopeicgaming1999 (47 views)
2014-11-26 15:20:36

toopeicgaming1999 (8 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (26 views)
2014-11-25 11:26:43

Gibbo3771 (23 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!