File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,17 @@ public class PerlinNoise : INoise
1313 /// <summary>
1414 /// Permutation
1515 /// </summary>
16- private readonly int [ ] _p = new int [ 512 ] ;
16+ private readonly byte [ ] _p = new byte [ 512 ] ;
1717
1818 /// <summary>
1919 /// Initializes a new instance of the <see cref="PerlinNoise"/> class.
2020 /// </summary>
2121 /// <param name="seed">Seed for generating permutaion.</param>
2222 public PerlinNoise ( int seed )
2323 {
24- var random = new Random ( seed ) ;
24+ var random = new UniformRNG ( ( ulong ) seed ) ;
2525 for ( int i = 0 ; i < 256 ; i ++ )
26- _p [ i + 256 ] = _p [ i ] = random . Next ( 0 , 256 ) ;
26+ _p [ i + 256 ] = _p [ i ] = ( byte ) ( random . NextUInt32 ( ) % 256 ) ;
2727 }
2828
2929 public float Noise ( float x , float y , float z )
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ public double Uniform(double a, double b)
9797
9898 private uint Next ( )
9999 {
100+ _state ^= _state >> 13 ;
101+ _state ^= ( _state << 7 ) | 0x9d2c5680 ;
102+ _state ^= ( _state << 15 ) & 0xefc67a5b ;
100103 _state = _state * _multiplier + _increment ;
101104 return ( uint ) _state ;
102105 }
You can’t perform that action at this time.
0 commit comments