当前位置: 首页 > news >正文

西安做网站设计的公司漯河网站开发

西安做网站设计的公司,漯河网站开发,网页传奇游戏单职业,云电脑免费体验30天目录 一&#xff1a;C语言中的随机数 二&#xff1a;C中的随机数 1. 生成随机数的例子 2. 随机数引擎 3. 随机数引擎适配器 4. C中预定义的随机数引擎&#xff0c;引擎适配器 5. 随机数分布 一&#xff1a;C语言中的随机数 <stdlib.h>//初始化随机种子 srand(static_ca…

目录

一:C语言中的随机数

二:C++中的随机数

    1. 生成随机数的例子

    2. 随机数引擎

    3. 随机数引擎适配器

    4. C++中预定义的随机数引擎,引擎适配器

    5. 随机数分布


一:C语言中的随机数

<stdlib.h>//初始化随机种子
srand(static_cast<unsigned int>(time(nullptr)));//生成随机数
cout << rand() << endl;//生成一个区间的内随机数(min, max)
return static_cast<int>(rand() % (max + 1UL - min)) + min;//生成100内随机数
int num = rand() % 100;//生成1-100内随机数
int num = rand() % 100 + 1;

二:C++中的随机数

    1. 生成随机数的例子
include <random>
#include <map>
#include <iostream>int main()
{static const int NUM = 1000000;//第一步 产生随机种子std::random_device seed;//第二步:使用随机数引擎生成器std::mt19937 gen(seed());//第三步:为随机数选择一种分布,此处选择均匀分布std::uniform_int_distribution<> uniformDist(0, 20); // min= 0; max= 20for (int i = 1; i <= NUM; ++i) {std::cout << uniformDist(gen) << " ";}
}
    2. 随机数引擎
引擎说明
random_device真随机数(非基于软件生成器),通常用来产生随机种子
linear_congruential_engine线性同余法生成器
mersenne_twister_engine梅森素数法生成器
subtract_with_carry_engine带进位减法随机数生成器
    3. 随机数引擎适配器
template<class Engine, size_t p, size_t r> class discard_block_engine {...}
template<class Engine, size_t w, class UIntT> class independent_bits_engine {...}
template<class Engine, size_t k> class shuffle_order_engine {...}
    4. C++中预定义的随机数引擎,引擎适配器

  5. 随机数分布
template<class IntType = int> class uniform_int_distribution
uniform_int_distribution(IntType a = 0, IntType b = numeric_limits<IntType>::max());template<class RealType = double> class uniform_real_distribution
uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);class bernoulli_distribution
bernoulli_distribution(double p = 0.5);template<class IntType = int> class binomial_distribution
binomial_distribution(IntType t = 1, double p = 0.5);template<class IntType = int> class geometric_distribution
geometric_distribution(double p = 0.5);template<class IntType = int> class negative_binomial_distribution
negative_binomial_distribution(IntType k = 1, double p = 0.5)template<class IntType = int> class poisson_distribution
poisson_distribution(double mean = 1.0);template<class RealType = double> class exponential_distribution
exponential_distribution(RealType lambda = 1.0);template<class RealType = double> class gamma_distribution
gamma_distribution(RealType alpha = 1.0, RealType beta = 1.0);template<class RealType = double> class weibull_distribution
weibull_distribution(RealType a = 1.0, RealType b = 1.0);template<class RealType = double> class extreme_value_distribution
extreme_value_distribution(RealType a = 0.0, RealType b = 1.0);template<class RealType = double> class normal_distribution
normal_distribution(RealType mean = 0.0, RealType stddev = 1.0);template<class RealType = double> class lognormal_distribution
lognormal_distribution(RealType m = 0.0, RealType s = 1.0);template<class RealType = double> class chi_squared_distribution
chi_squared_distribution(RealType n = 1);template<class RealType = double> class cauchy_distribution
cauchy_distribution(RealType a = 0.0, RealType b = 1.0);template<class RealType = double> class fisher_f_distribution
fisher_f_distribution(RealType m = 1, RealType n = 1);template<class RealType = double> class student_t_distribution
student_t_distribution(RealType n = 1);template<class IntType = int> class discrete_distribution
discrete_distribution(initializer_list<double> wl);template<class RealType = double> class piecewise_constant_distribution
template<class UnaryOperation>piecewise_constant_distribution(initializer_list<RealType> bl,
UnaryOperation fw);template<class RealType = double> class piecewise_linear_distribution
template<class UnaryOperation>piecewise_linear_distribution(initializer_list<RealType> bl,
UnaryOperation fw);

http://www.yayakq.cn/news/625999/

相关文章:

  • 网站做担保交易平台wordpress7验证码插件
  • 公司的官方网站怎么做宜昌怎样优化网站建设
  • 经典企业网站模板集团网站建设需求
  • 如何做网站免费校园网站群建设
  • 福建省建设执业注册与管理中心网站seo研究中心qq群
  • 网站下载服务器配置怎么可以做网站的网站
  • 做谷歌网站企业网站建设的主要步骤
  • 做网站游戏都需要什么wordpress打赏插件
  • 视频网站怎么做网站引流自己本地可以做网站服务器吗
  • 网站做ppt模板济南制作网站的公司吗
  • 环球资源网发展现状seo关键词排名优化推荐
  • 建设银行英文网站网页设计实训报告心得体会
  • 怎么建站网站网上开店铺需要什么流程
  • 用iis制作简单网站天琥设计培训
  • 手机网站设计立找亿企邦网站编辑模版
  • 成都大丰五块石网站建设wordpress说明文档
  • 做唯品客网站的感想建设银行忘记密码网站
  • 阜阳网站建设阜阳安卓html编辑器中文版
  • 视频网站开发架构有什么好网站做浏览器主页
  • 各大网站热搜榜排名网站开发是网站后台开发吗
  • vps 网站 需要绑定域名吗官方网站建设思路
  • 网站配色简历在哪里制作免费
  • 企业网站例子男人的天堂哔哩哔哩
  • 商丘企业网站服务wordpress中途修改固定连接
  • 微官网怎么关注吉林百度seo
  • 动画做视频在线观看网站知名的网页制作公司多少钱
  • 佛山做外贸网站咨询云开发技术
  • 全英文外贸网站建设深圳最新政策消息
  • 视频网站建站费用南宁网站制作建设
  • 怎么才能让自己做的网站上传到百度搜关键字可以搜到新浪网页