Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ protected override void BeginProcessing()

if (Wait)
{
_activityId = (new Random()).Next();
_activityId = Random.Shared.Next();
if (_timeout == -1 || _timeout >= int.MaxValue / 1000)
{
_timeoutInMilliseconds = int.MaxValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ private void FlushPendingOutput()
{
// System transcripts can have high contention. Do exponential back-off on writing
// if needed.
int delay = new Random().Next(10) + 1;
int delay = Random.Shared.Next(10) + 1;
bool written = false;

while (!written)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ internal static void LogScriptBlockCreation(ScriptBlock scriptBlock, bool force)
// But split the segments into random sizes (10k + between 0 and 10kb extra)
// so that attackers can't creatively force their scripts to span well-known
// segments (making simple rules less reliable).
int segmentSize = 10000 + (new Random()).Next(10000);
int segmentSize = 10000 + Random.Shared.Next(10000);
int segments = (int)Math.Floor((double)(scriptBlockText.Length / segmentSize)) + 1;
int currentLocation = 0;
int currentSegmentSize = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ internal UpdatableHelpCommandBase(UpdatableHelpCommandType commandType)
_exceptions = new Dictionary<string, UpdatableHelpExceptionContext>();
_helpSystem.OnProgressChanged += HandleProgressChanged;

Random rand = new Random();

activityId = rand.Next();
activityId = Random.Shared.Next();
}

#endregion
Expand Down