mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 13:49:07 +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)
|
if(usedBias.Count >= ALL_BIAS.Count)
|
||||||
usedBias.Clear();
|
usedBias.Clear();
|
||||||
|
|
||||||
int randomBiasIndex;
|
var randomBiasIndex = Random.Shared.Next(0, ALL_BIAS.Count);
|
||||||
lock (RANDOM)
|
while(usedBias.Contains(randomBiasIndex))
|
||||||
{
|
randomBiasIndex = Random.Shared.Next(0, ALL_BIAS.Count);
|
||||||
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
|
|
||||||
while(usedBias.Contains(randomBiasIndex))
|
|
||||||
randomBiasIndex = RANDOM.Next(0, ALL_BIAS.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
usedBias.Add(randomBiasIndex);
|
usedBias.Add(randomBiasIndex);
|
||||||
return ALL_BIAS.Values.ElementAt(randomBiasIndex);
|
return ALL_BIAS.Values.ElementAt(randomBiasIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Random RANDOM = new();
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user