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

📄 random_matrix.cpp

📁 This collection of C++ templates wraps the FORTRAN or C interfaces for LAPACK so that they integrate
💻 CPP
字号:
#include <boost/random.hpp>

namespace {

class Random {
public: 
	Random() : rng(), gen_uniform(rng), gen_normal(rng,norm) {}

	double uniform() { return gen_uniform(); }
	double normal() { return gen_normal(); }

	void seed(boost::uint32_t s) { 
		rng.seed(s); 
		boost::uniform_01<boost::mt19937, double> tmp(rng); 
		gen_uniform = tmp; 
	}

private:
	boost::mt19937 rng;
	boost::uniform_01<boost::mt19937, double> gen_uniform;
	boost::normal_distribution<> norm;
	boost::variate_generator<boost::mt19937, boost::normal_distribution<> > gen_normal; 
};

} // unnamed namespace

⌨️ 快捷键说明

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