aboutsummaryrefslogtreecommitdiff
path: root/std/rand/ziggurat.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-31 10:56:59 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-31 17:28:07 -0400
commitfcbb7426faac5e693ef195defe2d8d2a2eddadb1 (patch)
treed34d161ccdbdacb0d0177b79aeb54605f9a49bd3 /std/rand/ziggurat.zig
parent717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a (diff)
downloadzig-fcbb7426faac5e693ef195defe2d8d2a2eddadb1.tar.gz
zig-fcbb7426faac5e693ef195defe2d8d2a2eddadb1.zip
use * for pointer type instead of &
See #770 To help automatically translate code, see the zig-fmt-pointer-reform-2 branch. This will convert all & into *. Due to the syntax ambiguity (which is why we are making this change), even address-of & will turn into *, so you'll have to manually fix thes instances. You will be guaranteed to get compile errors for them - expected 'type', found 'foo'
Diffstat (limited to 'std/rand/ziggurat.zig')
-rw-r--r--std/rand/ziggurat.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/std/rand/ziggurat.zig b/std/rand/ziggurat.zig
index 7daeb59165..774d3bd52a 100644
--- a/std/rand/ziggurat.zig
+++ b/std/rand/ziggurat.zig
@@ -12,7 +12,7 @@ const std = @import("../index.zig");
const math = std.math;
const Random = std.rand.Random;
-pub fn next_f64(random: &Random, comptime tables: &const ZigTable) f64 {
+pub fn next_f64(random: *Random, comptime tables: *const ZigTable) f64 {
while (true) {
// We manually construct a float from parts as we can avoid an extra random lookup here by
// using the unused exponent for the lookup table entry.
@@ -60,7 +60,7 @@ pub const ZigTable = struct {
// whether the distribution is symmetric
is_symmetric: bool,
// fallback calculation in the case we are in the 0 block
- zero_case: fn (&Random, f64) f64,
+ zero_case: fn (*Random, f64) f64,
};
// zigNorInit
@@ -70,7 +70,7 @@ fn ZigTableGen(
comptime v: f64,
comptime f: fn (f64) f64,
comptime f_inv: fn (f64) f64,
- comptime zero_case: fn (&Random, f64) f64,
+ comptime zero_case: fn (*Random, f64) f64,
) ZigTable {
var tables: ZigTable = undefined;
@@ -110,7 +110,7 @@ fn norm_f(x: f64) f64 {
fn norm_f_inv(y: f64) f64 {
return math.sqrt(-2.0 * math.ln(y));
}
-fn norm_zero_case(random: &Random, u: f64) f64 {
+fn norm_zero_case(random: *Random, u: f64) f64 {
var x: f64 = 1;
var y: f64 = 0;
@@ -149,7 +149,7 @@ fn exp_f(x: f64) f64 {
fn exp_f_inv(y: f64) f64 {
return -math.ln(y);
}
-fn exp_zero_case(random: &Random, _: f64) f64 {
+fn exp_zero_case(random: *Random, _: f64) f64 {
return exp_r - math.ln(random.float(f64));
}