50 strcpy(message,
"libsqlstat plugin is not loaded. "
51 "Use 'INSTALL PLUGIN' for installation.");
55 if (args->arg_count > 2 || args->arg_count < 0) {
56 strcpy(message,
"rand_norm() takes up to two arguments");
60 for ( i = 0; i < (int) args->arg_count; i++) {
61 args->arg_type[i] = REAL_RESULT;
64 initid->maybe_null = 0;
66 initid->max_length = 13 + initid->decimals;
68 initid->const_item = 0;
84 double rand_norm(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
88 if (args->arg_count >= 1) {
92 sigma = *((
double*) args->args[0]);
95 if (args->arg_count >= 2) {
99 mu = *((
double*) args->args[1]);
my_bool rand_norm_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
Called before first usage of function.
Definition of functions for UDFs and plugins.
Definitions for random number generations.
double rand_norm(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Retrieve a variate of the normal distribution.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
static double gaussian()
Returns variate of the normal distribution.
void rand_norm_deinit(UDF_INIT *initid)
Called after last access to function.
Mersenne Twister random number generator.
int sqlstat_plugin_isloaded()
Check if plugin loaded.