Beispiel #1
0
        public static uint Hash32(float x, float y, float z)
        {
            var hasher = Hasher.Create();

            hasher.AddAligned64(TwoSinglesULongUnion.ReinterpretCast(x, y));
            hasher.Add(SingleUIntUnion.ReinterpretCast(z));
            return(hasher.Finalize32());
        }
Beispiel #2
0
        public static float NextFloat(ref ulong state)
        {
            uint  v         = (NextUInt32(ref state) & 0b01111111_11111111_11111111u) | 0x3F800000u;
            float zeroToOne = SingleUIntUnion.ReinterpretCast(v) - 1.0f;

            CoreException.Assert(zeroToOne >= 0.0f && zeroToOne < 1.0);
            return(zeroToOne);
        }