rand: add pub to next/jump

I specifically needed jump for an application and it doesn't appear to
be exposed in any way.
This commit is contained in:
Jacob Young 2022-12-18 01:23:36 -05:00
parent 4809e0ea7f
commit 0ccdc511ce
2 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ pub fn random(self: *Xoroshiro128) Random {
return Random.init(self, fill);
}
fn next(self: *Xoroshiro128) u64 {
pub fn next(self: *Xoroshiro128) u64 {
const s0 = self.s[0];
var s1 = self.s[1];
const r = s0 +% s1;
@ -33,7 +33,7 @@ fn next(self: *Xoroshiro128) u64 {
}
// Skip 2^64 places ahead in the sequence
fn jump(self: *Xoroshiro128) void {
pub fn jump(self: *Xoroshiro128) void {
var s0: u64 = 0;
var s1: u64 = 0;

View File

@ -22,7 +22,7 @@ pub fn random(self: *Xoshiro256) Random {
return Random.init(self, fill);
}
fn next(self: *Xoshiro256) u64 {
pub fn next(self: *Xoshiro256) u64 {
const r = math.rotl(u64, self.s[0] +% self.s[3], 23) +% self.s[0];
const t = self.s[1] << 17;
@ -40,7 +40,7 @@ fn next(self: *Xoshiro256) u64 {
}
// Skip 2^128 places ahead in the sequence
fn jump(self: *Xoshiro256) void {
pub fn jump(self: *Xoshiro256) void {
var s: u256 = 0;
var table: u256 = 0x39abdc4529b1661ca9582618e03fc9aad5a61266f0c9392c180ec6d33cfd0aba;