c++ 随机数 std::mt19937
立即使用:
#include <random> #include <iostream> int main() { std::random_device rd; std::mt19937 gen{rd()}; int x = gen(); // x 就是生成的随机数了 std::cout << "随机数:" << x << std::endl; }
写于2025年4月7日
Copyright 2024-2025 fayige.top
Distributed under the Boost Software License, Version 1.0.
(See accompanying
file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)