parent
29187574be
commit
9ebf0384a5
@ -0,0 +1,22 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in new issue