0

I want a sort of deterministic virtual "noise plain" of uniformly distributed values which can be sampled at any (x, y) point in random order. I think some hash function of (x + y + seed) where seed is calculated from some initial image properties might work. So I need a fastest possible non cryptographic function which doesn't produce visible regular artefacts. What do I have to choose from?

e_asphyx
  • 151
  • 4
  • Related: https://stackoverflow.com/questions/45120396 – Peter O. Feb 13 '22 at 16:17
  • Murmurhash will probably give you good results while being quite fast. – Leo Feb 13 '22 at 17:12
  • 2
    A problem with `someHash(x+y+seed)` is that it depends only on x+y, so you will get straight lines where the hash is constant. An alternative is to use the result of the Cantor pairing function of (x,y), as an offset into a pseudo-random sequence like [MRG32k3a](https://www.iro.umontreal.ca/~simardr/ssj/doc/html/umontreal/iro/lecuyer/rng/MRG32k3a.html). The advantage of a Multiple Recursive Generator (MRG) is that it is very cheap to compute the random value at some arbitrary offset. See [older SO question](https://stackoverflow.com/a/62003862/11282404) for an example implementation. – jpmarinier Feb 13 '22 at 18:27
  • Under "+" operation I have assumed any combining function, not just plain summation. It may be a chain like hash(hash(seed | x) | y) for example. Anyway, I'll take a look, thanks. – e_asphyx Feb 13 '22 at 18:57

0 Answers0