| 334 | } |
| 335 | |
| 336 | static uint32_t get_rng_seed(uint32_t seed) { |
| 337 | if (seed == LLAMA_DEFAULT_SEED) { |
| 338 | // use system clock if std::random_device is not a true RNG |
| 339 | static bool is_rd_prng = std::random_device().entropy() == 0; |
| 340 | if (is_rd_prng) { |
| 341 | return (uint32_t) std::chrono::system_clock::now().time_since_epoch().count(); |
| 342 | } |
| 343 | std::random_device rd; |
| 344 | return rd(); |
| 345 | } |
| 346 | return seed; |
| 347 | } |
| 348 | |
| 349 | // llama_sampler API |
| 350 |
no test coverage detected