⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rng.h

📁 粗糙集应用软件
💻 H
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

#ifndef __RNG_H__
#define __RNG_H__

#include <copyright.h>

//-------------------------------------------------------------------
// Class.........: RNG
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Random number generator, uniform distribution.
//
//                 Based on code taken from the book "Numerical Recipes
//                 in C".
//
// Comments......: Consider either renaming this to UniformRNG, and to
//                 let RNG be an abstract base class for all
//                 distribution types.
// Revisions.....:
//===================================================================

class RNG {
protected:

	//- Private member variables.......................................
	long  seed_;  // Initial seed.
	long  idum_;  // Current state, mutable.

public:

	//- Constructors/destructor........................................
	RNG();
	RNG(long seed);
	~RNG();

	//- Seed management................................................
	long  GetSeed() const;
	void  SetSeed(long seed);

	//- Draw uniform deviates..........................................
	float DrawFloat(float lower = 0.0, float upper = 1.0) const;
	int   DrawInteger(int lower, int upper) const;

};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -