use std::chrono::system_clock::now() for random seed
This commit is contained in:
parent
4dba7e8114
commit
6134134080
1 changed files with 2 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
#define LLAMA_API_INTERNAL
|
#define LLAMA_API_INTERNAL
|
||||||
#include "sampling.h"
|
#include "sampling.h"
|
||||||
|
#include <chrono>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
struct llama_sampling_context * llama_sampling_init(const struct llama_sampling_params & params) {
|
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) {
|
void llama_sampling_set_rng_seed(struct llama_sampling_context * ctx, uint32_t seed) {
|
||||||
if (seed == LLAMA_DEFAULT_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);
|
ctx->rng.seed(seed);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue