📄 rand.h
字号:
/* RAND.H - Interface to random number generation procedures. */
/* Copyright (c) 1995, 2000, 2001 by Radford M. Neal
*
* Permission is granted for anyone to copy, use, or modify this program
* for purposes of research or education, provided this copyright notice
* is retained, and note is made of any changes that have been made.
*
* This program is distributed without any warranty, express or implied.
* As this program was written for research purposes only, it has not been
* tested to the degree that would be advisable in any important application.
* All use of this program is entirely at the user's own risk.
*/
#ifndef RAND_H
#define RAND_H
/* STATE OF RANDOM NUMBER GENERATOR. */
#define N_tables 5 /* Number of tables of real random numbers */
typedef struct
{ int seed; /* Seed state derives from */
int ptr[N_tables]; /* Pointers for tables of real random numbers */
unsigned short state48[3]; /* State of 'rand48' pseudo-random generator */
} rand_state;
typedef enum sp_make_method
{ Evencol, /* Uniform number of bits per column, with number specified */
Evenboth /* Uniform (as possible) over both columns and rows */
} sp_make_method;
typedef enum { Sparse, Dense, Mixed } gen_make_method; /* Ways of making it */
struct rand_sp_parmt
{
int chk_num; //times to check a bit
int pos_no; //row or col no.
};
struct rand_sp_pos
{
int row; //row no. to check a bit
int col; //col no. to check a bit
};
struct rand_sp_pos *chk_pos; //the positions of 1s in sp_matrix
/* BASIC PSEUDO-RANDOM GENERATION PROCEDURES. */
int rand_int(int, int);
void rand_int_num( int * , int, int);
double rand_uniopen (int);
double rand_uniform (int);
void rand01( int *data, int ,int);
void markov_symbol(int *symbol, int symbollength,double p);
double rand_gaussian (int);
double rand_logistic (int);
float uniform(int *seed);
void gen_symbol(int *symbol, int symbollength,double p[],int size);
void rand_seed( int);
static void initialize (void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -