?? hcsampler.cpp
字號:
// HCSampler.cpp
#include <algorithm>
#include "HCSampler.h"
#include "Random.h"
namespace az
{
namespace alg
{
void LHC(std::vector< std::vector<double> >& rand, std::vector<double>& low, std::vector<double>& upp)
{
unsigned int i,j;
for(i=0; i<rand.size(); i++)
{
for(j=0; j<rand[i].size(); j++) rand[i][j] = low[i] + (upp[i]-low[i])*(j+rnd::rand(0.0,1.0))/double(rand[i].size());
std::random_shuffle(rand[i].begin(), rand[i].end());
}
}
void Uniform(std::vector< std::vector<double> >& rand, std::vector<double>& low, std::vector<double>& upp)
{
unsigned int i,j;
for(i=0; i<rand.size(); i++) for(j=0; j<rand[i].size(); j++) rand[i][j] = rnd::rand(low[i],upp[i]);
}
} //namespace alg
} //namespace az
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -