tiny.simd.CachedXoshiro
Defined in random.
Source
Source: lib/simd/src/random.zig:199
zig
pub fn CachedXoshiro(comptime D: type, comptime cache_size: usize) type { if (cache_size == 0 or !std.math.isPowerOfTwo(cache_size)) { @compileError("cached xoshiro size must be a nonzero power of two"); } return struct { generator: Generator, cache: [cache_size]u64, index: usize, const Self = @This(); const Generator: type = VectorXoshiro(D); pub fn init(seed: u64) Self { return initThread(seed, 0); } pub fn initThread(seed: u64, thread_number: u64) Self { var result = Self{ .generator = Generator.initThread(seed, thread_number), .cache = undefined, .index = 0, }; result.generator.fill(&result.cache); return result; } pub fn next(self: *Self) u64 { std.debug.assert(self.index <= cache_size); if (self.index == cache_size) { self.generator.fill(&self.cache); self.index = 0; } const result = self.cache[self.index]; self.index += 1; return result; } pub fn minimum() u64 { return 0; } pub fn maximum() u64 { return std.math.maxInt(u64); } };}Source: lib/simd/src/root.zig:509
zig
pub const CachedXoshiro = random.CachedXoshiro;Audit
| Definitions | 1 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |