public static void TearDown() { CryptoRandom?.Dispose(); CryptoRandom = null; Random?.Dispose(); Random = null; }
public Connection(IThreadsafeRandom Random, NodeBase FromNode, NodeBase ToNode, TimeSpan MinLatency, TimeSpan MaxLatency) { _random = Random; this.FromNode = FromNode; this.ToNode = ToNode; _minLatency = MinLatency; _maxLatency = MaxLatency; }
protected NodeBase(IThreadsafeRandom Random, int Id, string Name, string RegionName) { this.Random = Random; this.Id = Id; this.Name = Name; this.RegionName = RegionName; Values = new ConcurrentDictionary <string, string>(); Online = true; }
public static void Shuffle <T>(this IList <T> Items, IThreadsafeRandom Random) { // Use the Fischer-Yates algorithm. // See https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle var maxIndex = Items.Count - 1; for (var index = maxIndex; index > 0; index--) { var swapIndex = Random.Next(0, index + 1); var temp = Items[index]; Items[index] = Items[swapIndex]; Items[swapIndex] = temp; } }
public QuorumNode(IThreadsafeRandom Random, int Id, string Name, string RegionName, int RequiredVotes, bool ReadRepair) : base(Random, Id, Name, RegionName) { _requiredVotes = RequiredVotes; _readRepair = ReadRepair; }
public XmlGenerator(IThreadsafeRandom Random) { _random = Random; _elementNames = new Stack <string>(); _actionPercentages = new[] { 60, 80 }; // Close, open, write element. }
public Client(IThreadsafeRandom Random, int Id, string Name, string RegionName) : base(Random, Id, Name, RegionName) { }
public void SetUp() { Random = new ThreadsafeRandom(); CryptoRandom = new ThreadsafeCryptoRandom(); }