jeudi 16 juillet 2020

does Mathf.PerlinNoise() rely on the internal random number generator?

I am using Unity c#, and I am coding something that relies on Perlin noise to determine a random number between 0 and 1. I would like to implement a feature in my code that allows the user to define a specific pre-determined seed number to use for this, but I am not sure if the Perlin noise function actually uses the same random seed as the Random class does.

For example; if I want to generate Perlin noise using Mathf.PerlinNoise() - will it always be the same if I always set the RNG seed priory, using the same number?

minimal code example:

Random.InitState(4815162342);
    float _randomSample = Mathf.PerlinNoise(yada yada yada);

I would like to use this for a Minecraft-like system of generating a procedural game world and having a way for the player to choose a seed would be great. in that code example, the player's chosen seed was the numbers from the TV show "Lost". (4815162342)




Aucun commentaire:

Enregistrer un commentaire