ASCOT5
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
random.h File Reference

Header file for random.c. More...

#include <stdlib.h>

Go to the source code of this file.

Macros

#define random_init(data, seed)   srand48(seed)
 
#define random_uniform(data)   drand48()
 
#define random_normal(data)   random_drand48_normal()
 
#define random_uniform_simd(data, n, r)   random_drand48_uniform_simd(n, r)
 
#define random_normal_simd(data, n, r)   random_drand48_normal_simd(n, r)
 

Typedefs

typedef void * random_data
 

Functions

double random_drand48_normal ()
 Initialize random generator which uses the linear congruential algorithm and 48-bit integer arithmetic.
 
void random_drand48_uniform_simd (int n, double *r)
 Vectorised sampling from uniform distribution.
 
void random_drand48_normal_simd (int n, double *r)
 Vectorised sampling from normal distribution.
 

Detailed Description

Header file for random.c.

Definition in file random.h.

Macro Definition Documentation

◆ random_init

#define random_init ( data,
seed )   srand48(seed)

Initialize random number generator

Definition at line 94 of file random.h.

◆ random_uniform

#define random_uniform ( data)    drand48()

Sample random number [0.0,1.0) from from uniform distribution

Definition at line 96 of file random.h.

◆ random_normal

#define random_normal ( data)    random_drand48_normal()

Sample from Normal distribution

Definition at line 98 of file random.h.

◆ random_uniform_simd

#define random_uniform_simd ( data,
n,
r )   random_drand48_uniform_simd(n, r)

Same as random_uniform but vectorised

Definition at line 100 of file random.h.

◆ random_normal_simd

#define random_normal_simd ( data,
n,
r )   random_drand48_normal_simd(n, r)

Same as random_normal but vectorised

Definition at line 102 of file random.h.

Typedef Documentation

◆ random_data

typedef void* random_data

Data used by the random number generator

Definition at line 87 of file random.h.

Function Documentation

◆ random_drand48_normal()

double random_drand48_normal ( )

Initialize random generator which uses the linear congruential algorithm and 48-bit integer arithmetic.

Definition at line 166 of file random.c.

◆ random_drand48_uniform_simd()

void random_drand48_uniform_simd ( int n,
double * r )

Vectorised sampling from uniform distribution.

Uses the linear congruential algorithm and 48-bit integer arithmetic.

Parameters
nnumber of numbers to be sampled
rpointer where the values are stored

Definition at line 180 of file random.c.

◆ random_drand48_normal_simd()

void random_drand48_normal_simd ( int n,
double * r )

Vectorised sampling from normal distribution.

Uses the linear congruential algorithm and 48-bit integer arithmetic.

Parameters
nnumber of numbers to be sampled
rpointer where the values are stored

Definition at line 195 of file random.c.