bool TestExtMath::test_mt_srand() { f_mt_srand(); f_mt_srand(0); f_mt_srand(1); VERIFY(f_mt_rand(5, 15) == 11); return Count(true); }
String f_spl_object_hash(CObjRef obj) { if (!s_inited) { Lock lock(s_mutex); if (!s_inited) { f_mt_srand(); s_hash_mask_handle |= f_mt_rand(); s_hash_mask_handle <<= 16; s_hash_mask_handle |= f_mt_rand(); s_hash_mask_handle <<= 16; s_hash_mask_handle |= f_mt_rand(); s_hash_mask_handle <<= 16; s_hash_mask_handle |= f_mt_rand(); s_inited = true; } } char buf[33]; snprintf(buf, sizeof(buf), "%032llx", s_hash_mask_handle ^ (int64)obj.get()); return String(buf, CopyString); }
bool TestExtMath::test_mt_rand() { f_mt_rand(); VERIFY(f_mt_rand(5, 15) >= 5); VERIFY(f_mt_rand(5, 15) <= 15); return Count(true); }