Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
selimanac committed Sep 28, 2019
1 parent b309128 commit d591df6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main/main.script
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ function init(self)
test()

-- Static seed test
init_state = 9191672977641436033
init_seq = 11568046644284625181
init_state = 9191672977641436
init_seq = 1156804664428462

rnd.seed(init_state, init_seq)

print("Static")
test()

-- entropy test
-- re-seed by using entropy
rnd.seed() -- Seed the generator using entropy
test()

Expand Down
5 changes: 5 additions & 0 deletions pcgrandom/src/pcgrandom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <math.h>
#include "entropy.h"

//#define __STDC_FORMAT_MACROS
//#include <inttypes.h>

//#include <time.h>

static pcg32_random_t rng;
Expand Down Expand Up @@ -82,6 +85,8 @@ static int seedgen(lua_State *L)
{
seedinitstate = luaL_checknumber(L, 1);
seedinitseq = luaL_checknumber(L, 2);
//printf("seedinitstate: %" PRIu64 "\n", seedinitstate);
//printf("seedinitseq: %" PRIu64 "\n", seedinitseq);
pcg32_srandom_r(&rng, seedinitstate, seedinitseq);
}

Expand Down

0 comments on commit d591df6

Please sign in to comment.