summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell+tor@mumble.net>2019-01-10 17:40:17 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2019-01-11 14:40:50 +0200
commit0f8253bddbaae4e73fe2ff9ecf1c342e3f66b798 (patch)
tree366bb540a1d8b902be9aa78554e93fd7f288d061 /src/core
parent531df9590d006434b31cc81871b73c31ca9f896b (diff)
downloadtor-0f8253bddbaae4e73fe2ff9ecf1c342e3f66b798.tar.gz
tor-0f8253bddbaae4e73fe2ff9ecf1c342e3f66b798.zip
Use the distribution abstraction as an abstraction.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/circuitpadding.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index 6a39a7b371..a5d5d24551 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -545,7 +545,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
.a = dist.param1,
.b = dist.param2,
};
- return uniform_sample(&my_uniform.base);
+ return dist_sample(&my_uniform.base);
}
case CIRCPAD_DIST_LOGISTIC:
{
@@ -555,7 +555,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
.mu = dist.param1,
.sigma = dist.param2,
};
- return logistic_sample(&my_logistic.base);
+ return dist_sample(&my_logistic.base);
}
case CIRCPAD_DIST_LOG_LOGISTIC:
{
@@ -565,12 +565,16 @@ circpad_distribution_sample(circpad_distribution_t dist)
.alpha = dist.param1,
.beta = dist.param2,
};
- return log_logistic_sample(&my_log_logistic.base);
+ return dist_sample(&my_log_logistic.base);
}
case CIRCPAD_DIST_GEOMETRIC:
{
/* param1 is 'p' (success probability) */
- return geometric_sample(dist.param1);
+ const struct geometric my_geometric = {
+ .base = DIST_BASE(&geometric_ops),
+ .p = dist.param1,
+ };
+ return dist_sample(&my_geometric.base);
}
case CIRCPAD_DIST_WEIBULL:
{
@@ -580,7 +584,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
.k = dist.param1,
.lambda = dist.param2,
};
- return weibull_sample(&my_weibull.base);
+ return dist_sample(&my_weibull.base);
}
case CIRCPAD_DIST_PARETO:
{
@@ -591,7 +595,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
.sigma = dist.param1,
.xi = dist.param2,
};
- return genpareto_sample(&my_genpareto.base);
+ return dist_sample(&my_genpareto.base);
}
}