public void TestMemberFn_GetHashCode_i () { HashSet<Int32> hs = new HashSet<Int32>(); var rand = new System.Random(); var buff = new Byte[4]; UInt32 collisions = 0; for(Int32 i = 0; i < Settings.NumTests; ++i) { rand.NextBytes(buff); UInt32 packed = BitConverter.ToUInt32(buff, 0); var packedObj = new Rgba32(); packedObj.PackedValue = packed; Int32 hc = packedObj.GetHashCode (); if(hs.Contains(hc)) ++collisions; hs.Add(hc); } Assert.That(collisions, Is.LessThan(10)); }