Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

879755 Posts in 33002 Topics- by 24376 Members - Latest Member: xnothegame1

May 24, 2013, 09:10:04 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)research librarian: what is the name of this random noise function?
Pages: [1]
Print
Author Topic: research librarian: what is the name of this random noise function?  (Read 1393 times)
zovirl
Level 1
*


Mark Ivey


View Profile WWW Email
« on: August 19, 2011, 08:50:16 PM »

Here's a piece of code for a random number generator. I'm trying figure out the name of the algorithm it is implementing:

Code:
double IntegerNoise (int n)
{
  n = (n >> 13) ^ n;
  int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  return 1.0 - ((double)nn / 1073741824.0);
}

Now, this code shows up on dozens of sites...all you have to do to find them is search for the primes: google.com/search?q=60493+19990303+1376312589. I happened to find it on libnoise.sourceforge.net, but this popular page on perlin noise has a very similar implementation (different primes, but very similar code): http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

None of the sites say what the name of the algorithm is, though. Most say something like "I found this on the internet, it seems to work..."

It looks related to either Linear congruential generators (http://en.wikipedia.org/wiki/Linear_congruential_generator) or maybe multiply-with-carry (http://en.wikipedia.org/wiki/Multiply-with-carry). It doesn't look exactly like either of those though.

Anyone recognize this?
Logged

Forest, a walking meditation game. (behind the scenes)
HTML5 fighting game, a game jam prototype.
www.zovirl.com
Evan Balster
Level 10
*****


dreaming close to metal


View Profile WWW Email
« Reply #1 on: August 20, 2011, 02:32:30 PM »

No idea.  D:

Is it a lagged fibonacci?
Logged

Infinite Blank, SoundSelf, Cave Story+, Wreath
voice, accordion, mandolin, (oboe, soon)
Game audio programming consultant.
<plaid/audio>: opensource audio framework
zovirl
Level 1
*


Mark Ivey


View Profile WWW Email
« Reply #2 on: August 20, 2011, 05:03:58 PM »

I don't know. According to Wikipedia, Freeciv uses lagged-fibbonaci, and http://svn.gna.org/viewcvs/freeciv/trunk/utility/rand.c?view=markup looks a lot more complicated than what I have. I think that means this isn't lagged-fibbonaci, but that's pretty tenuous Smiley
Logged

Forest, a walking meditation game. (behind the scenes)
HTML5 fighting game, a game jam prototype.
www.zovirl.com
eigenbom
Level 10
*****



View Profile WWW
« Reply #3 on: August 20, 2011, 05:18:40 PM »

Algorithmic archaeology!

I found an early reference in Gfx Gems II, dating back to 1988 ... Maybe you should email Greg Ward (the author) to ask him where he got it from...

http://tog.acm.org/resources/GraphicsGems/gemsii/noise3.c



Logged

Nix
Level 10
*****



View Profile
« Reply #4 on: August 20, 2011, 06:49:02 PM »

It seems like one of those techniques that's so trivial and well-known it's not associated with a title. Maybe there's a paper lying out there about it though.
Logged
zovirl
Level 1
*


Mark Ivey


View Profile WWW Email
« Reply #5 on: August 23, 2011, 09:28:08 PM »

Algorithmic archaeology!

I found an early reference in Gfx Gems II, dating back to 1988 ... Maybe you should email Greg Ward (the author) to ask him where he got it from...

http://tog.acm.org/resources/GraphicsGems/gemsii/noise3.c


Nice find!  I emailed Greg Ward and he didn't remember its origins either. Lost to the depths of time, I guess?  It is kind of strange since many of the other well-known PRNG algorithms are even simpler (and therefore easier to copy/paste). Oh well.
Logged

Forest, a walking meditation game. (behind the scenes)
HTML5 fighting game, a game jam prototype.
www.zovirl.com
eigenbom
Level 10
*****



View Profile WWW
« Reply #6 on: August 24, 2011, 03:02:08 PM »

Algorithmic archaeology!

I found an early reference in Gfx Gems II, dating back to 1988 ... Maybe you should email Greg Ward (the author) to ask him where he got it from...

http://tog.acm.org/resources/GraphicsGems/gemsii/noise3.c


Nice find!  I emailed Greg Ward and he didn't remember its origins either. Lost to the depths of time, I guess?  It is kind of strange since many of the other well-known PRNG algorithms are even simpler (and therefore easier to copy/paste). Oh well.

Ah that's too bad, But at least we now know GW didn't come up with it. Just call it the Pre-Ward method. Tongue

B
Logged

zovirl
Level 1
*


Mark Ivey


View Profile WWW Email
« Reply #7 on: August 25, 2011, 08:11:04 PM »


Ah that's too bad, But at least we now know GW didn't come up with it. Just call it the Pre-Ward method. Tongue


Actually, he said he didn't remember if he came up with it or if he grabbed it from someplace else, so we don't even know that much Smiley
Logged

Forest, a walking meditation game. (behind the scenes)
HTML5 fighting game, a game jam prototype.
www.zovirl.com
Mipe
Level 10
*****


Migrating to imagination.


View Profile
« Reply #8 on: August 25, 2011, 11:26:11 PM »

I recall seeing this algorithm in Perlin noise...
Logged
Nix
Level 10
*****



View Profile
« Reply #9 on: August 26, 2011, 10:53:55 AM »

I recall seeing this algorithm in Perlin noise...

There are lots of ways to create Perlin noise, so there are probably a number of implementations that use this as an RNG
Logged
Jasmine
Level 6
*


Location: England


View Profile
« Reply #10 on: August 26, 2011, 12:08:55 PM »

It comes from a branch of mathematics called elliptic curves.

It's a pretty deep subject, and it was all the rage in the 1960/70s.

If you want to give it a name, it's an elliptic curve pseudorandom number generator.


What are elliptic curves you ask?


The number systems we use are characterised by two operators: addition and multiplication. And these two operators make sense and behave nicely. Numbers are nicely structured additively and multiplicatively.

In mathematics we call such number systems Rings.

Well it was discovered that there is actually another operation through which numbers behave nicely, but it is extremely complicated and arcane.

Imagine if all you ever knew was addition. Imagine trying to live without knowledge of multiplication. Imagine how flat the world would feel, and how impossible some things would be. Then one day you discovered multiplication - that would be a major discovery, yes? Your understanding of quantity would be dramatically changed.

Elliptic curves are exactly like that! Discovering them is as eye opening as the discovery of multiplication. Smiley
« Last Edit: August 26, 2011, 12:41:47 PM by Jasmine » Logged

I ain't pushing no moon buttons.
zovirl
Level 1
*


Mark Ivey


View Profile WWW Email
« Reply #11 on: August 26, 2011, 08:31:37 PM »

Fascinating...the equation does have the form ax^3 + bx + c, yet searching for "elliptic curve pseudorandom number generator" yields very little information...mostly scholarly articles, and mostly post-1988.
Logged

Forest, a walking meditation game. (behind the scenes)
HTML5 fighting game, a game jam prototype.
www.zovirl.com
Jasmine
Level 6
*


Location: England


View Profile
« Reply #12 on: August 27, 2011, 02:44:26 AM »

That's probably because the internet only came about post-1988. All the original articles will be in old books in old libraries. Some of the research may be classified too as it has implications for code breaking.

Try searching for the acronym;

http://www.google.com/search?q=ecrng
« Last Edit: August 27, 2011, 02:51:20 AM by Jasmine » Logged

I ain't pushing no moon buttons.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic