コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PerlinNoise(uint seed)
        {
            var xorshit = new XorShift(seed);

            int[] p = new int[256];
            for (int i = 0; i < p.Length; i++)
            {
                // 0 - 255の間のランダムな値を生成する
                p[i] = (int)Mathf.Floor(xorshit.Random() * 256);
            }

            // pの倍の数の配列を生成する
            int[] p2 = new int[p.Length * 2];
            for (int i = 0; i < p2.Length; i++)
            {
                p2[i] = p[i & 255];
            }

            _p = p2;
        }