Random Number Generator. The class implements RNG using Multiply-with-Carry algorithm.
operations.hpp
Ejemplo n.º 1
0
        /// <summary>
        /// shuffles the input array elements
        /// </summary>
        /// <param name="dst">The input/output numerical 1D array</param>
        /// <param name="iterFactor">The scale factor that determines the number of random swap operations.</param>
        /// <param name="rng">The optional random number generator used for shuffling. 
        /// If it is null, theRng() is used instead.</param>
        public static void RandShuffle(InputOutputArray dst, double iterFactor, RNG rng = null)
        {
            if (dst == null)
                throw new ArgumentNullException("dst");
            dst.ThrowIfNotReady();

            if (rng == null)
            {
                NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, IntPtr.Zero);
            }
            else
            {
                ulong state = rng.State;
                NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, ref state);
                rng.State = state;
            }
            dst.Fix();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// shuffles the input array elements
 /// </summary>
 /// <param name="iterFactor">The scale factor that determines the number of random swap operations.</param>
 /// <param name="rng">The optional random number generator used for shuffling. 
 /// If it is null, theRng() is used instead.</param>
 /// <returns>The input/output numerical 1D array</returns>
 public void RandShuffle(double iterFactor, RNG rng = null)
 {
     Cv2.RandShuffle(this, iterFactor, rng);
 }