我试图使用std::random_device生成随机数,但是每次运行程序时它们都是相同的。我使用在线IDE尝试了相同的代码,并且按预期运行。根据answer here,这是Cygwin和MSYS2中的错误。
如何升级MSYS2? 我尝试在其终端中运行命令pacman -Syupacman -Su,但出现错误:

MSYS ~ $ pacman -Syuu error: mingw32: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up
remotely error: mingw64: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up
remotely error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04"
is unknown error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could
not be looked up remotely :: Synchronizing package databases...
mingw32                  472.5 KiB   305K/s 00:02
[#####################] 100%  mingw32.sig              438.0   B
0.00B/s 00:00 [#####################] 100% error: mingw32: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up
remotely error: failed to update mingw32 (invalid or corrupted
database (PGP signature))  mingw64                  475.0 KiB   346K/s
00:01 [#####################] 100%  mingw64.sig              438.0   B
0.00B/s 00:00 [#####################] 100% error: mingw64: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up
remotely error: failed to update mingw64 (invalid or corrupted
database (PGP signature))  msys                     189.8 KiB   164K/s
00:01 [#####################] 100%  msys.sig                 438.0   B
0.00B/s 00:00 [#####################] 100% error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown error: key
"4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up
remotely error: failed to update msys (invalid or corrupted database
(PGP signature)) error: failed to synchronize all databases
是否可以在Windows上生成随机数?

最佳答案

我通过引用this news page on MSYS2使它起作用。在其余步骤无效之前,我必须运行pacman -Sydd pacman

关于c++ - 为什么MSYS2的随机数都一样?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63201980/

10-10 21:25