use Random.Shared

This commit is contained in:
UbitUmarov
2022-10-16 15:06:36 +01:00
parent 0f3d7f45d9
commit 8895577c80
20 changed files with 63 additions and 85 deletions

View File

@@ -335,7 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_dumpAssetToFile)
{
Util.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
Util.SaveAssetToFile("updateditem" + Random.Shared.Next(1, 1000) + ".dat", data);
}
response.StatusCode = (int)HttpStatusCode.OK;
@@ -417,7 +417,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_dumpAssetToFile)
{
Util.SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data);
Util.SaveAssetToFile("updatedtaskscript" + Random.Shared.Next(1, 1000) + ".dat", data);
}
// m_log.InfoFormat("[CAPS]: TaskInventoryScriptUpdater.uploaderCaps res: {0}", res);

View File

@@ -375,8 +375,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_ids[agentID]++;
else
{
Random rnd = new Random(Environment.TickCount);
m_ids[agentID] = rnd.Next(30000000);
m_ids[agentID] = Random.Shared.Next(30000000);
}
}
}
@@ -402,8 +401,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_ids[agentID] = -m_ids[agentID];
else
{
Random rnd = new Random(Environment.TickCount);
m_ids[agentID] = -rnd.Next(30000000);
m_ids[agentID] = -Random.Shared.Next(30000000);
}
}
}
@@ -417,8 +415,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_ids[agentID]++;
else
{
Random rnd = new Random(Environment.TickCount);
m_ids.Add(agentID, rnd.Next(30000000));
m_ids.Add(agentID, Random.Shared.Next(30000000));
}
}
}
@@ -518,8 +515,7 @@ namespace OpenSim.Region.ClientStack.Linden
{
if (element == null && negativeID)
{
Random rnd = new Random(Environment.TickCount);
m_ids[pAgentId] = rnd.Next(30000000);
m_ids[pAgentId] = Random.Shared.Next(30000000);
}
else
m_ids[pAgentId] = thisID + 1;

View File

@@ -105,12 +105,6 @@ namespace OpenMetaverse
}
#region PacketDropDebugging
/// <summary>
/// For debugging purposes only... random number generator for dropping
/// outbound packets.
/// </summary>
private Random m_dropRandomGenerator = new Random();
/// <summary>
/// For debugging purposes only... parameters for a simplified
/// model of packet loss with bursts, overall drop rate should
@@ -135,7 +129,7 @@ namespace OpenMetaverse
/// </summary>
private bool DropOutgoingPacket()
{
double rnum = m_dropRandomGenerator.NextDouble();
double rnum = Random.Shared.NextDouble();
// if the connection has been idle for awhile (more than m_dropResetTicks) then
// reset the state to the default state, don't continue a burst