15 #include "../include/tscope5/randomizer_internal.h"
16 #include "../include/tscope5/system_internal.h"
18 #include <gsl/gsl_rng.h>
19 #include <gsl/gsl_randist.h>
37 ts5_log(TS5_LOGLEVEL_6,
"%s: ts5_check_randomizer\n", calling_function);
63 ts5_log(TS5_LOGLEVEL_1,
"%s: Installing Tscope5 randomizer\n",
66 _ts5_data.randomizer = gsl_rng_alloc(gsl_rng_ranlxs2);
68 if (!_ts5_data.randomizer) {
69 ts5_fatal(
"%s: could not install Tscope5 randomizer\n",
75 gettimeofday(&tv, NULL);
76 unsigned long seed = tv.tv_usec;
77 gsl_rng_set(_ts5_data.randomizer, seed);
78 ts5_log(TS5_LOGLEVEL_1,
"%s: Random seed is %lu\n",
79 calling_function, seed);
95 ts5_log(TS5_LOGLEVEL_1,
"Uninstalling Tscope5 randomizer\n");
97 gsl_rng_free(_ts5_data.randomizer);
98 _ts5_data.randomizer = NULL;
int _ts5_is_tscope5_installed
Is Tscope5 installed?
void ts5_uninstall_randomizer()
Uninstall the randomizer subsystem.
int _ts5_is_randomizer_installed
Is the randomizer subsystem installed?
void ts5_check_randomizer(char *calling_function)
Do some checks at the start of each randomizer function.
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
void ts5_install_tscope5(char *calling_function)
Install Tscope5.
void ts5_fatal(const char *format,...)
Exit safely with an error message.
void ts5_install_randomizer(char *calling_function)
Install the randomizer subsystem.