Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Normal = struct {
- mean: f64,
- standard_deviation: f64,
- pub fn sample(normal: Normal, r: *std.rand.Random) f64 {
- return normal.mean + myrng.random.floatNorm(f64) * normal.standard_deviation;
- }
- };
- test "Normal" {
- var r = std.rand.Xoroshiro128.init(42);
- const normal = Normal{ .mean = 0, .standard_deviation = 1 };
- std.debug.warn("\n\nrandom = {}\n\n", normal.sample(&r));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement