authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-12-18 01:23:36-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-12-18 01:46:09-05:00
log0ccdc511cebfa3db1dfcbd05fe849843da117657
tree7e578ef352916654c58c66336c4ab0a03126a87f
parent4809e0ea7f53d1b56cbc4c6e62e4b8ea40936d44

rand: add pub to next/jump

I specifically needed jump for an application and it doesn't appear to be exposed in any way.

2 files changed, 4 insertions(+), 4 deletions(-)

lib/std/rand/Xoroshiro128.zig+2-2
......@@ -20,7 +20,7 @@ pub fn random(self: *Xoroshiro128) Random {
2020 return Random.init(self, fill);
2121}
2222
23fn next(self: *Xoroshiro128) u64 {
23pub fn next(self: *Xoroshiro128) u64 {
2424 const s0 = self.s[0];
2525 var s1 = self.s[1];
2626 const r = s0 +% s1;
......@@ -33,7 +33,7 @@ fn next(self: *Xoroshiro128) u64 {
3333}
3434
3535// Skip 2^64 places ahead in the sequence
36fn jump(self: *Xoroshiro128) void {
36pub fn jump(self: *Xoroshiro128) void {
3737 var s0: u64 = 0;
3838 var s1: u64 = 0;
3939
lib/std/rand/Xoshiro256.zig+2-2
......@@ -22,7 +22,7 @@ pub fn random(self: *Xoshiro256) Random {
2222 return Random.init(self, fill);
2323}
2424
25fn next(self: *Xoshiro256) u64 {
25pub fn next(self: *Xoshiro256) u64 {
2626 const r = math.rotl(u64, self.s[0] +% self.s[3], 23) +% self.s[0];
2727
2828 const t = self.s[1] << 17;
......@@ -40,7 +40,7 @@ fn next(self: *Xoshiro256) u64 {
4040}
4141
4242// Skip 2^128 places ahead in the sequence
43fn jump(self: *Xoshiro256) void {
43pub fn jump(self: *Xoshiro256) void {
4444 var s: u256 = 0;
4545
4646 var table: u256 = 0x39abdc4529b1661ca9582618e03fc9aad5a61266f0c9392c180ec6d33cfd0aba;