Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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.

Pages: [1]
EgonOlsen (58 views)
2018-06-10 19:43:48

EgonOlsen (40 views)
2018-06-10 19:43:44

EgonOlsen (60 views)
2018-06-10 19:43:20

DesertCoockie (225 views)
2018-05-13 18:23:11

nelsongames (141 views)
2018-04-24 18:15:36

nelsongames (140 views)
2018-04-24 18:14:32

ivj94 (882 views)
2018-03-24 14:47:39

ivj94 (143 views)
2018-03-24 14:46:31

ivj94 (794 views)
2018-03-24 14:43:53

Solater (158 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!