Show / Hide Table of Contents

    Class RandomElementExtension

    Inheritance
    System.Object
    RandomElementExtension
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Catalyst.Core.Lib.Extensions
    Assembly: Catalyst.Core.Lib.dll
    Syntax
    public static class RandomElementExtension

    Methods

    | Improve this Doc View Source

    RandomElement<T>(IEnumerable<T>)

    Takes a random element

    Declaration
    public static T RandomElement<T>(this IEnumerable<T> list)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> list
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    RandomSample<T>(IEnumerable<T>, Int32)

    Takes a random sample from list, must have more than 3 items in list, to take a sample of at least 2

    Declaration
    public static IList<T> RandomSample<T>(this IEnumerable<T> list, int sampleSize)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> list
    System.Int32 sampleSize
    Returns
    Type Description
    System.Collections.Generic.IList<T>
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Shuffle<T>(IEnumerable<T>)

    Randomises order of list

    Declaration
    public static IList<T> Shuffle<T>(this IEnumerable<T> source)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> source
    Returns
    Type Description
    System.Collections.Generic.IList<T>
    Type Parameters
    Name Description
    T
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Catalyst Network