0からn-1までのc ++乱数


#include <ctime>
#include <thread>

int main()
{

	std::srand((unsigned)time(NULL));
	std::cout << time(NULL) << std::endl;
	while (true)
	{
		int tmpvalue = rand() % 10000; //产生0-9999之间的随机数
		std::cout << tmpvalue << std::endl;
		std::this_thread::sleep_for(std::chrono::seconds(1));
	}

}

 

おすすめ

転載: blog.csdn.net/m0_37981386/article/details/107735514