| 303 | } |
| 304 | |
| 305 | static uint32_t get_rng_seed(uint32_t seed) { |
| 306 | if (seed == LLAMA_DEFAULT_SEED) { |
| 307 | // use system clock if std::random_device is not a true RNG |
| 308 | static bool is_rd_prng = std::random_device().entropy() == 0; |
| 309 | if (is_rd_prng) { |
| 310 | return (uint32_t) std::chrono::system_clock::now().time_since_epoch().count(); |
| 311 | } |
| 312 | std::random_device rd; |
| 313 | return rd(); |
| 314 | } |
| 315 | return seed; |
| 316 | } |
| 317 | |
| 318 | // llama_sampler API |
| 319 |
no test coverage detected