云起工作室 15711107967
16-boost-foreach
2022-10-09 17:14:43

c++ 11 提供的for循环

for(int e : arr) // for(auto e:arr)

{}


boost

#include<boost/foreach.hpp>

using namespace boost;

BOOST_FOREACH(auto &e , arr){}


BOOSTR_REVERSE_FOREACH(auto &e,arr){}



伪随机数

#include<boost/random.hpp>


1、mt19937 mt(time(0));

mt.min() mt.max()

mt() 生成随机数


2、rand48 r48

r48()生成随机数


3、

uniform_smallint : 在小整数域内的均匀分布

uniform_int 在整数域【min,max】上的均匀分布

uniform_01: 在区间【0,1】上的实数连续均匀分布

uniform_real: 在区间【min,max】上的师叔连续均匀分布

binomial_distribution:二项分布

gamma_distribution:伽马分布

poisson_distribution:泊松分布

geometric_distribution:几何分布

triangle_distribution:三角分布

exponential_distribution:正态分布

uniform_on_sphere:球面均匀分布