Skip to content

Implement Philox RNG seeding #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/include/clRNG/philox432.clh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct clrngPhilox432Counter_ {


typedef struct {
cl_uint key[2]; // 64-bit key
clrngPhilox432Counter ctr; // 128 bits counter
cl_uint deck[4]; // this table hold the 4x32 generated uint from philox4x32(ctr,kry) function
cl_uint deckIndex; //the index of actual pregenerated integer to give to the user
Expand Down
1 change: 1 addition & 0 deletions src/include/clRNG/philox432.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef struct clrngPhilox432Counter_ {


typedef struct {
cl_uint key[2]; // 64-bit key
clrngPhilox432Counter ctr; // 128 bits counter
cl_uint deck[4]; // this table hold the 4x32 generated uint from philox4x32(ctr,kry) function
cl_uint deckIndex; //the index of actual pregenerated integer to give to the user
Expand Down
2 changes: 1 addition & 1 deletion src/include/clRNG/private/philox432.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ clrngStatus clrngPhilox432CopyOverStreams(size_t count, clrngPhilox432Stream* de
void clrngPhilox432GenerateDeck(clrngPhilox432StreamState *currentState)
{
//Default key
philox4x32_key_t k = { { 0, 0 } };
philox4x32_key_t k = { { currentState->key[0], currentState->key[1] } };

//get the currect state
philox4x32_ctr_t c = { { 0 } };
Expand Down
3 changes: 2 additions & 1 deletion src/library/philox432.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct clrngPhilox432StreamCreator_ {
*/

#define BASE_CREATOR_STATE { \
{0, 0}, \
{{ 0, 0},{ 0, 1}}, \
{ 0, 0, 0, 0 }, \
0 }
Expand Down Expand Up @@ -147,7 +148,7 @@ clrngStatus clrngPhilox432ChangeStreamsSpacing(clrngPhilox432StreamCreator* crea

//Create Base Creator
clrngPhilox432StreamCreator* baseCreator = clrngPhilox432CopyStreamCreator(NULL, NULL);
clrngPhilox432StreamState baseState = { { { 0, 0 }, { 0, 0 } }, { 0, 0, 0, 0 }, 0 };
clrngPhilox432StreamState baseState = { { 0, 0 }, { { 0, 0 }, { 0, 0 } }, { 0, 0, 0, 0 }, 0 };
clrngPhilox432SetBaseCreatorState(baseCreator, &baseState);

//Create stream
Expand Down