-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolas Cornu
committed
Jan 31, 2024
1 parent
a710366
commit 1c55983
Showing
6 changed files
with
79 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "NrnRandom123RNG.hpp" | ||
|
||
NrnRandom123::NrnRandom123(std::uint32_t id1, std::uint32_t id2, std::uint32_t id3) { | ||
s_ = nrnran123_newstream3(id1, id2, id3); | ||
} | ||
|
||
NrnRandom123::~NrnRandom123() { | ||
nrnran123_deletestream(s_); | ||
} | ||
|
||
std::uint32_t NrnRandom123::asLong() { | ||
return nrnran123_ipick(s_); | ||
} | ||
|
||
double NrnRandom123::asDouble() { | ||
return nrnran123_dblpick(s_); | ||
} | ||
|
||
void NrnRandom123::reset() { | ||
nrnran123_setseq(s_, 0, 0); | ||
} | ||
|
||
std::uint32_t NrnRandom123::get_seq() const { | ||
std::uint32_t seq; | ||
char which; | ||
nrnran123_getseq(s_, &seq, &which); | ||
return seq; | ||
} | ||
|
||
void NrnRandom123::set_seq(std::uint32_t seq) { | ||
nrnran123_setseq(s_, seq, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters