Exemplo n.º 1
0
        public static int Get(Vector2Ushort position, int minInclusive, int maxExclusive, uint seed = 0)
        {
            maxExclusive--;
            if (minInclusive == maxExclusive)
            {
                return(minInclusive);
            }

            Api.Assert(minInclusive < maxExclusive, "Min should be < max");

            var value = PositionHashHelper.GetHashDouble(position.X, position.Y, seed);
            var range = maxExclusive - minInclusive;

            value = minInclusive + value * range;
            return((int)Math.Round(value, MidpointRounding.AwayFromZero));
        }
Exemplo n.º 2
0
 public double Get(double x, double y)
 {
     return(PositionHashHelper.GetHashDouble((uint)x, (uint)y, this.seed));
 }