mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-02 14:19:02 +00:00
Common/Random: Add convenience template for simple arithmetic values
In cases where we just want a random value for a primitive arithmetic type, we can wrap this in a template to allow convenient direct assignment instead of keeping declaration and initialization separate (making it more difficult to use values uninitialized). This also allows the use of Common::Random with functions such as std::generate, making it more flexible in how random values can be generated.
This commit is contained in:
parent
e69c6cdaab
commit
189d277cfc
4 changed files with 15 additions and 6 deletions
|
@ -270,7 +270,7 @@ TraversalRequestId TraversalClient::SendTraversalPacket(const TraversalPacket& p
|
|||
{
|
||||
OutgoingTraversalPacketInfo info;
|
||||
info.packet = packet;
|
||||
Common::Random::Generate(&info.packet.requestId, sizeof(info.packet.requestId));
|
||||
info.packet.requestId = Common::Random::GenerateValue<TraversalRequestId>();
|
||||
info.tries = 0;
|
||||
m_OutgoingTraversalPackets.push_back(info);
|
||||
ResendPacket(&m_OutgoingTraversalPackets.back());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue