diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f64ee3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Visual Studio 2015/2017 cache/options directory +.vs/ + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ diff --git a/SimplexNoise/Noise.cs b/SimplexNoise/Noise.cs index 25a5090..fe9ebba 100644 --- a/SimplexNoise/Noise.cs +++ b/SimplexNoise/Noise.cs @@ -120,9 +120,14 @@ public static int Seed } else { + // permutation matrix is duplicated to handle rollovers _perm = new byte[512]; - var random = new Random(value); - random.NextBytes(_perm); + + var perm = new byte[256]; + new Random(value).NextBytes(perm); + + Array.Copy(perm, 0, _perm, 0, 256); + Array.Copy(perm, 0, _perm, 256, 256); } _seed = value;