Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions include/grass/defs/gis.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,21 @@ long G_srand48_auto(void);
long G_lrand48(void);
long G_mrand48(void);
double G_drand48(void);
void G_random_state_from_seed(struct G_random_state *, int64_t);
void G_random_init_layout_exact(struct G_random_layout *, int64_t, int64_t,
int64_t);
void G_random_init_layout_bounded(struct G_random_layout *, int64_t, int64_t,
int64_t);
void G_random_init_layout(struct G_random_layout *, int64_t, int64_t);
int64_t G_random_layout_batches(const struct G_random_layout *);
int64_t G_random_layout_length(const struct G_random_layout *);
void G_random_state_for_unit(struct G_random_state *,
const struct G_random_layout *, int64_t);
void G_random_state_for_batch(struct G_random_state *,
const struct G_random_layout *, int64_t, int64_t);
void G_random_advance(struct G_random_state *, int64_t);
double G_random_double(struct G_random_state *);
int64_t G_random_generate_seed(void);

/* ls.c */
void G_set_ls_filter(int (*)(const char *, void *), void *);
Expand Down
22 changes: 22 additions & 0 deletions include/grass/gis.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
/*============================= Include Files ==============================*/

/* System include files */
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>

Expand Down Expand Up @@ -628,6 +630,26 @@ struct Popen {
int pid;
};

/* A position of a pseudo-random number generator owned by the program;
* see G_random_state_from_seed() and G_random_state_for_unit(). The
* contents are private to the library and may change with the generator;
* read and advance the state only through the G_random_*() functions. It
* is a plain value: copying it copies the generator's position. */
struct G_random_state {
uint64_t state;
};

/* A layout: a seed and the way the generator's span is cut into streams
* of stride draws, one per unit of work and batch; see
* G_random_init_layout(). Private to the library. */
struct G_random_layout {
uint64_t start; /* generator state at the seed */
int64_t units;
int64_t stride;
int64_t batches; /* batches that fit into the span, 0 when none */
bool whole_span; /* a layout of the whole span holds a single batch */
};

typedef int CELL;
typedef double DCELL;
typedef float FCELL;
Expand Down
Loading
Loading