The R Project SVN R

Rev

Rev 58977 | Rev 68949 | Go to most recent revision | 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
58977 ripley 3
 *  Copyright (C) 1998-2011    The R Core Team
7727 ripley 4
 *
5
 *  This program 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
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12778 pd 13
 *  GNU Lesser General Public License for more details.
7727 ripley 14
 *
12778 pd 15
 *  You should have received a copy of the GNU Lesser General Public License
42308 ripley 16
 *  along with this program; if not, a copy is available at
17
 *  http://www.r-project.org/Licenses/
7727 ripley 18
 */
19
 
60253 ripley 20
/* Included by R.h: API */
21
 
7790 ripley 22
#ifndef R_RANDOM_H
23
#define R_RANDOM_H
7727 ripley 24
 
11211 ripley 25
#ifdef  __cplusplus
26
extern "C" {
27
#endif
28
 
48371 maechler 29
#include <R_ext/Boolean.h>
30
 
7727 ripley 31
typedef enum {
32
    WICHMANN_HILL,
33
    MARSAGLIA_MULTICARRY,
34
    SUPER_DUPER,
7790 ripley 35
    MERSENNE_TWISTER,
7842 ripley 36
    KNUTH_TAOCP,
18519 ripley 37
    USER_UNIF,
56570 ripley 38
    KNUTH_TAOCP2,
39
    LECUYER_CMRG
7727 ripley 40
} RNGtype;
41
 
7766 ripley 42
/* Different kinds of "N(0,1)" generators :*/
7727 ripley 43
typedef enum {
24322 ripley 44
    BUGGY_KINDERMAN_RAMAGE,
7727 ripley 45
    AHRENS_DIETER,
8438 ripley 46
    BOX_MULLER,
20253 ripley 47
    USER_NORM,
24322 ripley 48
    INVERSION,
49
    KINDERMAN_RAMAGE
7727 ripley 50
} N01type;
51
 
52
 
7842 ripley 53
void GetRNGstate(void);
54
void PutRNGstate(void);
7727 ripley 55
 
56
double unif_rand(void);
25960 ripley 57
/* These are also defined in Rmath.h */
7727 ripley 58
double norm_rand(void);
59
double exp_rand(void);
60
 
7842 ripley 61
typedef unsigned int Int32;
44195 ripley 62
double * user_unif_rand(void);
7842 ripley 63
void user_unif_init(Int32);
44195 ripley 64
int * user_unif_nseed(void);
65
int * user_unif_seedloc(void);
7842 ripley 66
 
44195 ripley 67
double * user_norm_rand(void);
11211 ripley 68
 
48371 maechler 69
void FixupProb(double *, int, int, Rboolean);
70
 
11211 ripley 71
#ifdef  __cplusplus
72
}
7727 ripley 73
#endif
11211 ripley 74
 
75
#endif /* R_RANDOM_H */