摘要: 下面从一个问题引入: // ConsoleApplication5.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include<random> #include<iostream> #include<vector> #include<thread> #incl 阅读全文
posted @ 2020-08-20 20:33 sunshine_gzw 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 如果有两个线程,其中一个线程想要获取另一个线程的返回值,该怎么办? 于是接下来要谈的package_task就是为了解决这个问题而诞生的。 // ConsoleApplication5.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include<random> 阅读全文
posted @ 2020-08-20 18:47 sunshine_gzw 阅读(352) 评论(0) 推荐(0) 编辑
摘要: // ConsoleApplication5.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include<random> #include<iostream> #include<vector> #include<thread> #include<algorit 阅读全文
posted @ 2020-08-20 15:16 sunshine_gzw 阅读(561) 评论(0) 推荐(0) 编辑
摘要: // ConsoleApplication5.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include<random> #include<iostream> #include<vector> #include<algorithm> using namespa 阅读全文
posted @ 2020-08-20 14:02 sunshine_gzw 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 首先我们要知道,计算机不能产生绝对的随机数。只能产生伪随机数。伪就是有规律的意思。伪随机数就是计算机产生的随机数是有规律的。 那么计算机是怎么产生随机数的? 当然是通过算法,这个算法是有映射关系的,如我放进1,他会出来一个特定的数 RAND_SEED=(RAND_SEED*123+59)%65536 阅读全文
posted @ 2020-08-20 12:45 sunshine_gzw 阅读(112) 评论(0) 推荐(0) 编辑