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.
Example #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);
        }
Example #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>>();
        }
Example #3
0
 public RandomUtils(SafeRandom randGen)
 {
     rand = randGen;
 }
Example #4
0
 public RandomUtils(int seed)
 {
     rand = new SafeRandom(seed);
 }
Example #5
0
 public RandomUtils()
 {
     rand = new SafeRandom();
 }
Example #6
0
 public AllToAllGeneration(SyncParty p, IList<int> pIds, BigInteger prime, SafeRandom randGen)
     : base(p, pIds)
 {
     RandGen = randGen;
     Prime = prime;
 }