mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 11:29:06 +00:00
Migrated to use the shared random instance (#214)
This commit is contained in:
parent
4ca5aba58f
commit
1c72c4d6ec
@ -5924,18 +5924,12 @@ public static class BiasCatalog
|
||||
{
|
||||
if(usedBias.Count >= ALL_BIAS.Count)
|
||||
usedBias.Clear();
|
||||
|
||||
int randomBiasIndex;
|
||||
lock (RANDOM)
|
||||
{
|
||||
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
|
||||
while(usedBias.Contains(randomBiasIndex))
|
||||
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
|
||||
}
|
||||
|
||||
var randomBiasIndex = Random.Shared.Next(0, ALL_BIAS.Count);
|
||||
while(usedBias.Contains(randomBiasIndex))
|
||||
randomBiasIndex = Random.Shared.Next(0, ALL_BIAS.Count);
|
||||
|
||||
usedBias.Add(randomBiasIndex);
|
||||
return ALL_BIAS.Values.ElementAt(randomBiasIndex);
|
||||
}
|
||||
|
||||
private static readonly Random RANDOM = new();
|
||||
}
|
Loading…
Reference in New Issue
Block a user