/// <summary> /// Utility to take a cursor, and get a shuffled version of this cursor. /// </summary> public static IRowCursor GetShuffledCursor(IChannelProvider provider, int poolRows, IRowCursor cursor, IRandom rand) { Contracts.CheckValue(provider, nameof(provider)); provider.CheckParam(poolRows > 0, nameof(poolRows), "Must be positive"); provider.CheckValue(cursor, nameof(cursor)); // REVIEW: In principle, we could limit this check to only active columns, // if we extend the use of this utility. provider.CheckParam(CanShuffleAll(cursor.Schema), nameof(cursor), "Cannot shuffle a cursor with some uncachable columns"); provider.CheckValue(rand, nameof(rand)); if (poolRows == 1) { return(cursor); } return(new RowCursor(provider, poolRows, cursor, rand)); }