summaryrefslogtreecommitdiff
path: root/llama.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llama.cpp')
-rw-r--r--llama.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llama.cpp b/llama.cpp
index 25203c9e..8334553a 100644
--- a/llama.cpp
+++ b/llama.cpp
@@ -2082,6 +2082,13 @@ int llama_get_kv_cache_token_count(struct llama_context * ctx) {
#define LLAMA_MAX_RNG_STATE 64*1024
+void llama_set_rng_seed(struct llama_context * ctx, int seed) {
+ if (seed <= 0) {
+ seed = time(NULL);
+ }
+ ctx->rng.seed(seed);
+}
+
// Returns the size of the state
size_t llama_get_state_size(struct llama_context * ctx) {
// we don't know size of rng until we actually serialize it. so reserve more than enough memory for its serialized state.