Implements a safe random number generator seeded using RNGCryptoServiceProvider. This RNG is safe meaning that the default seed value is time-independent so if more than one instance of it is created at the same "time", the random sequence generated by each instance is completely different (independent) from other instances'. WARNING: The sequence of random numbers generated by this method is NOT cryptographically-secure. DO NOT USE IN REAL SITUATIONS.
Пример #1
0
        public AlmostEverywhereProtocol(AsyncParty e, ReadOnlyCollection<int> processorIds, SafeRandom randGen, StateKey stateKey)
            : base(e, processorIds, stateKey)
        {
            if (randGen == null)
                randUtils = new RandomUtils();
            else
                randUtils = new RandomUtils(randGen);

            var cStr = ConfigurationManager.AppSettings["SampleListSizeFactor"];
            C = cStr == null ? 1 : float.Parse(cStr);
        }
Пример #2
0
        public Party()
        {
            Id = idGen++;
            NetSimulator.RegisterParty(this);
            SafeRandGen = new SafeRandom();

            RegisteredProtocols = new Dictionary<ulong, Protocol>();
            ParentProtocols = new Dictionary<ulong, ulong>();
            ChildProtocolOutstandingCount = new Dictionary<ulong, int>();
            ChildProtocolCompletedMsg = new Dictionary<ulong, SortedDictionary<ulong, object>>();
            ChildProtocolSubmissionOrder = new Dictionary<ulong, List<ulong>>();
        }
Пример #3
0
 public RandomUtils(SafeRandom randGen)
 {
     rand = randGen;
 }
Пример #4
0
 public RandomUtils(int seed)
 {
     rand = new SafeRandom(seed);
 }
Пример #5
0
 public RandomUtils()
 {
     rand = new SafeRandom();
 }
Пример #6
0
 public AllToAllGeneration(SyncParty p, IList<int> pIds, BigInteger prime, SafeRandom randGen)
     : base(p, pIds)
 {
     RandGen = randGen;
     Prime = prime;
 }