Server-Side Seeded Randomness Question

On the language side, you could use spatial noise, which will always return the same value for the same input, and similar values for “nearby” inputs. You can also use it to generate periodic nose. A little plug fo ther SimplexNoise-SC Quark (Announce: New SimplexNoise-SC Quark)… However, it seems you already have a solution you’re happy about on the language side. :wink:

Since you’re asking about the Server, I wonder if you’ve tried some tricks often used in (e.g. GLSL) shader programming. One common one is to get pseudo-noise using a scaled-large sine function. Something like this would work on the Server:

n = { arg x; frac(sin(x) * 43758.5453123) };

// Test it on Server:
{ var x = Line.ar(0, 100, 1, doneAction: Done freeSelf); f.(x) }.play;

Unlike spatial noise, calling it for values that are very close (0.01 and 0.02, for example) will produce pretty unrelated outputs, similar to hashing. It’s obviously not white noise, but if the values are far enough apart it sounds like it, as in my example above. In that case, it’s just a question of scaling the input to get what you want.

A good reference about noise in shader programming: GLSL Noise Algorithms · GitHub

1 Like