Example #1
0
 /// <summary>
 /// shuffles the input array elements
 /// </summary>
 /// <param name="dst"></param>
 /// <param name="iterFactor"></param>
 /// <param name="rng"></param>
 public static void RandShuffle(InputOutputArray dst, double iterFactor, out RNG rng)
 {
     if (dst == null)
         throw new ArgumentNullException("dst");
     dst.ThrowIfNotReady();
     ulong state;
     NativeMethods.core_randShuffle(dst.CvPtr, iterFactor, out state);
     dst.Fix();
     rng = new RNG(state);
 }
Example #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);
 }
Example #3
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();
        }