The R Project SVN R

Rev

Rev 90307 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7727 ripley 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
90299 maechler 3
 *  Copyright (C) 1998-2026    The R Core Team
7727 ripley 4
 *
71657 plummer 5
 *  This header file is free software; you can redistribute it and/or modify
12778 pd 6
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  the Free Software Foundation; either version 2.1 of the License, or
7727 ripley 8
 *  (at your option) any later version.
9
 *
71657 plummer 10
 *  This file is part of R. R is distributed under the terms of the
11
 *  GNU General Public License, either Version 2, June 1991 or Version 3,
12
 *  June 2007. See doc/COPYRIGHTS for details of the copyright status of R.
13
 *
7727 ripley 14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12778 pd 17
 *  GNU Lesser General Public License for more details.
7727 ripley 18
 *
12778 pd 19
 *  You should have received a copy of the GNU Lesser General Public License
42308 ripley 20
 *  along with this program; if not, a copy is available at
68949 ripley 21
 *  https://www.R-project.org/Licenses/
7727 ripley 22
 */
23
 
86515 luke 24
/* Included by R.h: Part of the API. */
60253 ripley 25
 
7790 ripley 26
#ifndef R_RANDOM_H
27
#define R_RANDOM_H
7727 ripley 28
 
70042 ripley 29
#include <R_ext/Boolean.h>
30
 
11211 ripley 31
#ifdef  __cplusplus
32
extern "C" {
33
#endif
34
 
7727 ripley 35
typedef enum {
36
    WICHMANN_HILL,
37
    MARSAGLIA_MULTICARRY,
38
    SUPER_DUPER,
7790 ripley 39
    MERSENNE_TWISTER,
7842 ripley 40
    KNUTH_TAOCP,
18519 ripley 41
    USER_UNIF,
56570 ripley 42
    KNUTH_TAOCP2,
43
    LECUYER_CMRG
7727 ripley 44
} RNGtype;
45
 
7766 ripley 46
/* Different kinds of "N(0,1)" generators :*/
7727 ripley 47
typedef enum {
24322 ripley 48
    BUGGY_KINDERMAN_RAMAGE,
7727 ripley 49
    AHRENS_DIETER,
8438 ripley 50
    BOX_MULLER,
20253 ripley 51
    USER_NORM,
24322 ripley 52
    INVERSION,
53
    KINDERMAN_RAMAGE
7727 ripley 54
} N01type;
55
 
76160 luke 56
/* Different ways to generate discrete uniform samples */
57
typedef enum {
58
    ROUNDING,
59
    REJECTION
60
} Sampletype;
82754 ripley 61
Sampletype R_sample_kind(void);
7727 ripley 62
 
90299 maechler 63
/* Different kinds of "Bin(n,p)" generators :*/
64
typedef enum {
65
    BUGGY_BTPE
66
  , BTPE
67
  // if you add a new option, update Bin_kind()'s check in RNG.c
68
} Binomtype;
90310 maechler 69
Binomtype R_binom_kind (void);
90299 maechler 70
 
7842 ripley 71
void GetRNGstate(void);
72
void PutRNGstate(void);
7727 ripley 73
 
74
double unif_rand(void);
72356 luke 75
double R_unif_index(double);
25960 ripley 76
/* These are also defined in Rmath.h */
7727 ripley 77
double norm_rand(void);
78
double exp_rand(void);
79
 
7842 ripley 80
typedef unsigned int Int32;
44195 ripley 81
double * user_unif_rand(void);
7842 ripley 82
void user_unif_init(Int32);
44195 ripley 83
int * user_unif_nseed(void);
84
int * user_unif_seedloc(void);
7842 ripley 85
 
44195 ripley 86
double * user_norm_rand(void);
11211 ripley 87
 
88
#ifdef  __cplusplus
89
}
7727 ripley 90
#endif
11211 ripley 91
 
92
#endif /* R_RANDOM_H */