You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
554 B
23 lines
554 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <rngxx.h>
|
|
|
|
static int next(rng_t* rng, const int* min, const int* max)
|
|
{
|
|
int output;
|
|
if(rng_next_tyb(rng, &output, RNG_TY_INT32, RNG_TYQ_SIGNED, min, max)) return output;
|
|
|
|
fprintf(stderr, "next<int>() failed\n");
|
|
exit(-1);
|
|
}
|
|
|
|
#define TREF(x) ( (const __typeof(x)[]){ (x) } )
|
|
int main()
|
|
{
|
|
rng_t* engine = rng_new(RNG_KIND_CRAND, (const u64[]){ 1000 });
|
|
printf("%d %d %d\n", next(engine, NULL, TREF(100)), next(engine, TREF(10), TREF(20)), next(engine, NULL, NULL));
|
|
rng_free(engine);
|
|
return 0;
|
|
}
|