use std::chrono::system_clock::now() for random seed

This commit is contained in:
David Renshaw 2024-04-27 20:37:12 -04:00
parent 4dba7e8114
commit 6134134080

View file

@ -1,5 +1,6 @@
#define LLAMA_API_INTERNAL
#include "sampling.h"
#include <chrono>
#include <random>
struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_params & params) {
@ -68,7 +69,7 @@ void llama_sampling_reset(llama_sampling_context * ctx) {
void llama_sampling_set_rng_seed(struct llama_sampling_context * ctx, uint32_t seed) {
if (seed == LLAMA_DEFAULT_SEED) {
seed = time(NULL);
seed = static_cast<uint32_t>(std::chrono::system_clock::now().time_since_epoch().count());
}
ctx->rng.seed(seed);
}