Statistics for MySQL  1.1
 All Classes Files Functions Variables Typedefs Macros Pages
Functions
rand_norm.cc File Reference

Generate random number from standard normal distribution. More...

#include "sqlstat.h"
#include "sqlrand.h"
Include dependency graph for rand_norm.cc:

Go to the source code of this file.

Functions

my_bool rand_norm_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Called before first usage of function. More...
 
double rand_norm (UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
 Retrieve a variate of the normal distribution. More...
 
void rand_norm_deinit (UDF_INIT *initid)
 Called after last access to function. More...
 

Detailed Description

Generate random number from standard normal distribution.

CREATE FUNCTION rand_norm RETURNS REAL SONAME 'libsqlstat.so'; SELECT rand_norm() FROM mytab; DROP FUNCTION rand_norm;

Definition in file rand_norm.cc.

Function Documentation

double rand_norm ( UDF_INIT *  initid,
UDF_ARGS *  args,
char *  is_null,
char *  error 
)

Retrieve a variate of the normal distribution.

The default value for the mean $\mu$ is 0, the default value of the standard deviation $\sigma$ is 1.

Parameters
initidfunction description
argsargument values
is_nullresult is NULL
errorerror message
Returns
random number

Definition at line 84 of file rand_norm.cc.

Here is the call graph for this function:

rand_norm_deinit ( UDF_INIT *  initid)

Called after last access to function.

Parameters
initid

Definition at line 111 of file rand_norm.cc.

my_bool rand_norm_init ( UDF_INIT *  initid,
UDF_ARGS *  args,
char *  message 
)

Called before first usage of function.

Checksparameters.
Indicate type of return value.

Parameters
initidfunction description
argsparameters
messageerror message
Returns
success = 0

Definition at line 46 of file rand_norm.cc.

Here is the call graph for this function: