MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / testGetSeed

Function testGetSeed

test/random.cpp:280–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279template<typename T>
280void testGetSeed(const uintl seed0, const uintl seed1) {
281 SUPPORTED_TYPE_CHECK(T);
282
283 uintl orig_seed = getSeed();
284
285 const int num = 1024;
286 dtype ty = (dtype)dtype_traits<T>::af_type;
287
288 setSeed(seed0);
289 array in0 = randu(num, ty);
290 ASSERT_EQ(getSeed(), seed0);
291
292 setSeed(seed1);
293 array in1 = randu(num, ty);
294 ASSERT_EQ(getSeed(), seed1);
295
296 setSeed(seed0);
297 array in2 = randu(num, ty);
298 ASSERT_EQ(getSeed(), seed0);
299
300 setSeed(orig_seed); // Reset the seed
301}
302
303TYPED_TEST(Random, getSeed) { testGetSeed<TypeParam>(1234, 9876); }
304

Callers

nothing calls this directly

Calls 3

getSeedFunction · 0.85
setSeedFunction · 0.85
randuFunction · 0.85

Tested by

no test coverage detected