public void GetDiffThreadTest()
        {
            Thread t1 = new Thread(obj => ((TempResult)obj).Rand = SyncRandom.Get());

            Random r2 = null;

            r2 = SyncRandom.Get();

            TempResult res = new TempResult();

            t1.Start(res);

            t1.Join();

            Assert.True(res.Rand != r2 && res.Rand != null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generate randomly indices of axes.
        /// </summary>
        /// <returns></returns>
        protected void GenerateIndicesOfAxes(int TotalTake)
        {
            int i = 0;

            Random rand = SyncRandom.Get();

            foreach (int coordIndex in Enumerable.Range(0, _coordNumbers.Length))
            {
                if (coordIndex < TotalTake)
                {
                    _coordNumbers[i++] = coordIndex;
                }
                else
                {
                    int swapIndex = rand.Next(i);

                    if (swapIndex < TotalTake)
                    {
                        _coordNumbers[swapIndex] = coordIndex;
                    }
                }
            }
        }
        public void GetTest()
        {
            Random rand = SyncRandom.Get();

            Assert.NotNull(rand);
        }