From cd575396c49692e82417b0fa5501f186ce10bc10 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Thu, 16 May 2024 16:42:11 -0400 Subject: [PATCH] add test --- src/test/unit/services/util/create_rng_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/unit/services/util/create_rng_test.cpp b/src/test/unit/services/util/create_rng_test.cpp index 5dee9c8656a..050e2b83d14 100644 --- a/src/test/unit/services/util/create_rng_test.cpp +++ b/src/test/unit/services/util/create_rng_test.cpp @@ -28,3 +28,12 @@ TEST(rng, initialize_with_zero) { rng2(); EXPECT_NE(rng1, rng2); } + +TEST(rng, run_twice_with_minus_one_seed) { + stan::rng_t rng1 = stan::services::util::create_rng(-1, 0); + EXPECT_EQ(rng1(), rng1()); +} +TEST(rng, run_twice_with_zero_seed) { + stan::rng_t rng1 = stan::services::util::create_rng(0, 0); + EXPECT_NE(rng1(), rng1()); +}