ASCOT5
Loading...
Searching...
No Matches
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)
#define random_uniform(data)
#define random_normal(data)
#define random_uniform_simd(data, n, r)
#define random_normal_simd(data, 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 )
Value:
srand48(seed)

Initialize random number generator

Definition at line 107 of file random.h.

◆ random_uniform

#define random_uniform ( data)
Value:
drand48()

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

Definition at line 109 of file random.h.

◆ random_normal

#define random_normal ( data)
Value:
double random_drand48_normal()
Initialize random generator which uses the linear congruential algorithm and 48-bit integer arithmeti...
Definition random.c:168

Sample from Normal distribution

Definition at line 111 of file random.h.

◆ random_uniform_simd

#define random_uniform_simd ( data,
n,
r )
Value:
void random_drand48_uniform_simd(int n, double *r)
Vectorised sampling from uniform distribution.
Definition random.c:182

Same as random_uniform but vectorised

Definition at line 113 of file random.h.

◆ random_normal_simd

#define random_normal_simd ( data,
n,
r )
Value:
void random_drand48_normal_simd(int n, double *r)
Vectorised sampling from normal distribution.
Definition random.c:197

Same as random_normal but vectorised

Definition at line 115 of file random.h.

Typedef Documentation

◆ random_data

typedef void* random_data

Data used by the random number generator

Definition at line 100 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 168 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 182 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 197 of file random.c.