diff options
| author | Tyge Løvset <[email protected]> | 2022-04-18 23:53:18 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-18 23:53:18 +0200 |
| commit | 58497293d88109624d4798c56e888bcbab7c4285 (patch) | |
| tree | 670f4f481672635f27363ea2d711a4cbb37618d6 /examples | |
| parent | 1eddea1da0125ddad2f8804fadafd1494c1bb11a (diff) | |
| download | STC-modified-58497293d88109624d4798c56e888bcbab7c4285.tar.gz STC-modified-58497293d88109624d4798c56e888bcbab7c4285.zip | |
crandom.h: Renamed *_init(..) functions to *_new(..). Old names are kept but deprecated.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/birthday.c | 4 | ||||
| -rw-r--r-- | examples/ex_gauss1.c | 4 | ||||
| -rw-r--r-- | examples/ex_gauss2.c | 4 | ||||
| -rw-r--r-- | examples/list.c | 4 | ||||
| -rw-r--r-- | examples/new_queue.c | 4 | ||||
| -rw-r--r-- | examples/priority.c | 4 | ||||
| -rw-r--r-- | examples/queue.c | 4 | ||||
| -rw-r--r-- | examples/random.c | 8 |
8 files changed, 18 insertions, 18 deletions
diff --git a/examples/birthday.c b/examples/birthday.c index 94438077..7c95f961 100644 --- a/examples/birthday.c +++ b/examples/birthday.c @@ -17,7 +17,7 @@ static void test_repeats(void) const static uint64_t mask = (1ull << BITS) - 1;
printf("birthday paradox: value range: 2^%d, testing repeats of 2^%d values\n", BITS, BITS_TEST);
- stc64_t rng = stc64_init(seed);
+ stc64_t rng = stc64_new(seed);
c_auto (cmap_ic, m)
{
cmap_ic_reserve(&m, N);
@@ -38,7 +38,7 @@ void test_distribution(void) {
enum {BITS = 26};
printf("distribution test: 2^%d values\n", BITS);
- stc64_t rng = stc64_init(seed);
+ stc64_t rng = stc64_new(seed);
const size_t N = 1ull << BITS ;
c_auto (cmap_x, map) {
diff --git a/examples/ex_gauss1.c b/examples/ex_gauss1.c index 63a4b45e..bdcd1bd3 100644 --- a/examples/ex_gauss1.c +++ b/examples/ex_gauss1.c @@ -30,8 +30,8 @@ int main() // Setup random engine with normal distribution.
uint64_t seed = time(NULL);
- stc64_t rng = stc64_init(seed);
- stc64_normalf_t dist = stc64_normalf_init(Mean, StdDev);
+ stc64_t rng = stc64_new(seed);
+ stc64_normalf_t dist = stc64_normalf_new(Mean, StdDev);
// Create and init histogram vec and map with defered destructors:
c_auto (cvec_pair, histvec)
diff --git a/examples/ex_gauss2.c b/examples/ex_gauss2.c index f2f11a4a..9558afd3 100644 --- a/examples/ex_gauss2.c +++ b/examples/ex_gauss2.c @@ -17,8 +17,8 @@ int main() // Setup random engine with normal distribution.
uint64_t seed = time(NULL);
- stc64_t rng = stc64_init(seed);
- stc64_normalf_t dist = stc64_normalf_init(Mean, StdDev);
+ stc64_t rng = stc64_new(seed);
+ stc64_normalf_t dist = stc64_normalf_new(Mean, StdDev);
// Create and init histogram map with defered destruct
c_auto (csmap_int, mhist)
diff --git a/examples/list.c b/examples/list.c index fd923719..b9f56f13 100644 --- a/examples/list.c +++ b/examples/list.c @@ -12,8 +12,8 @@ int main() { c_auto (clist_fx, list)
{
- stc64_t rng = stc64_init(1234);
- stc64_uniformf_t dist = stc64_uniformf_init(100.0f, n);
+ stc64_t rng = stc64_new(1234);
+ stc64_uniformf_t dist = stc64_uniformf_new(100.0f, n);
int m = 0;
c_forrange (i, int, n)
clist_fx_push_back(&list, stc64_uniformf(&rng, &dist)), ++m;
diff --git a/examples/new_queue.c b/examples/new_queue.c index 1b7c021c..3dde97f5 100644 --- a/examples/new_queue.c +++ b/examples/new_queue.c @@ -21,8 +21,8 @@ int point_cmp(const Point* a, const Point* b) { int main() {
int n = 60000000;
- stc64_t rng = stc64_init(time(NULL));
- stc64_uniform_t dist = stc64_uniform_init(0, n);
+ stc64_t rng = stc64_new(time(NULL));
+ stc64_uniform_t dist = stc64_uniform_new(0, n);
c_auto (cqueue_int, Q)
{
diff --git a/examples/priority.c b/examples/priority.c index 1767dba8..6e033386 100644 --- a/examples/priority.c +++ b/examples/priority.c @@ -10,8 +10,8 @@ int main() {
size_t N = 10000000;
- stc64_t rng = stc64_init(time(NULL));
- stc64_uniform_t dist = stc64_uniform_init(0, N * 10);
+ stc64_t rng = stc64_new(time(NULL));
+ stc64_uniform_t dist = stc64_uniform_new(0, N * 10);
c_auto (cpque_i, heap)
{
// Push ten million random numbers to priority queue
diff --git a/examples/queue.c b/examples/queue.c index db5f0e05..5f2fa03d 100644 --- a/examples/queue.c +++ b/examples/queue.c @@ -8,8 +8,8 @@ int main() {
int n = 100000000;
stc64_uniform_t dist;
- stc64_t rng = stc64_init(1234);
- dist = stc64_uniform_init(0, n);
+ stc64_t rng = stc64_new(1234);
+ dist = stc64_uniform_new(0, n);
c_auto (cqueue_i, queue)
{
diff --git a/examples/random.c b/examples/random.c index 59c1eb95..9ffcf0e2 100644 --- a/examples/random.c +++ b/examples/random.c @@ -6,7 +6,7 @@ int main() {
const size_t N = 1000000000;
const uint64_t seed = time(NULL), range = 1000000;
- stc64_t rng = stc64_init(seed);
+ stc64_t rng = stc64_new(seed);
uint64_t sum;
clock_t diff, before;
@@ -20,8 +20,8 @@ int main() diff = clock() - before;
printf("full range\t\t: %f secs, %" PRIuMAX ", avg: %f\n", (float) diff / CLOCKS_PER_SEC, N, (double) sum / N);
- stc64_uniform_t dist1 = stc64_uniform_init(0, range);
- rng = stc64_init(seed);
+ stc64_uniform_t dist1 = stc64_uniform_new(0, range);
+ rng = stc64_new(seed);
sum = 0;
before = clock();
c_forrange (N) {
@@ -31,7 +31,7 @@ int main() printf("unbiased 0-%" PRIuMAX "\t: %f secs, %" PRIuMAX ", avg: %f\n", range, (float) diff / CLOCKS_PER_SEC, N, (double) sum / N);
sum = 0;
- rng = stc64_init(seed);
+ rng = stc64_new(seed);
before = clock();
c_forrange (N) {
sum += stc64_rand(&rng) % (range + 1); // biased
|
