Show / Hide Table of Contents

    Class RandomExtensions

    Extensions to in order to randomly generate types and specially formatted strings that assist with testing custom extensions to Lucene.Net.

    Inheritance
    System.Object
    RandomExtensions
    Namespace: Lucene.Net
    Assembly: Lucene.Net.TestFramework.dll
    Syntax
    public static class RandomExtensions : object

    Methods

    | Improve this Doc View Source

    NextAnalysisString(Random, Int32, Boolean)

    Declaration
    public static string NextAnalysisString(this Random random, int maxLength, bool simple)
    Parameters
    Type Name Description
    Random random
    System.Int32 maxLength
    System.Boolean simple
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextBoolean(Random)

    Generates a random , with a random distribution of approximately 50/50.

    Declaration
    public static bool NextBoolean(this Random random)
    Parameters
    Type Name Description
    Random random

    This .

    Returns
    Type Description
    System.Boolean

    A random .

    | Improve this Doc View Source

    NextFilterStrategy(Random)

    Declaration
    public static FilteredQuery.FilterStrategy NextFilterStrategy(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    FilteredQuery.FilterStrategy
    | Improve this Doc View Source

    NextFixedByteLengthUnicodeString(Random, Int32)

    Returns random string, with a given UTF-8 byte length.

    Declaration
    public static string NextFixedByteLengthUnicodeString(this Random random, int length)
    Parameters
    Type Name Description
    Random random
    System.Int32 length
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextFixedLengthUnicodeString(Random, Char[], Int32, Int32)

    Fills provided char[] with valid random unicode code unit sequence.

    Declaration
    public static void NextFixedLengthUnicodeString(this Random random, char[] chars, int offset, int length)
    Parameters
    Type Name Description
    Random random
    System.Char[] chars
    System.Int32 offset
    System.Int32 length
    | Improve this Doc View Source

    NextFrom<T>(Random, ICollection<T>)

    Pick a random object from the collection.

    Declaration
    public static T NextFrom<T>(this Random random, ICollection<T> collection)
    Parameters
    Type Name Description
    Random random
    ICollection<T> collection
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    NextHtmlishString(Random, Int32)

    Returns a random HTML-like string.

    Declaration
    public static string NextHtmlishString(this Random random, int numElements)
    Parameters
    Type Name Description
    Random random
    System.Int32 numElements
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextInt64(Random)

    Generates a random .

    Declaration
    public static long NextInt64(this Random random)
    Parameters
    Type Name Description
    Random random

    This .

    Returns
    Type Description
    System.Int64

    A random .

    | Improve this Doc View Source

    NextInt64(Random, Int64, Int64)

    Generates a random . start and end are BOTH inclusive.

    Declaration
    public static long NextInt64(this Random random, long start, long end)
    Parameters
    Type Name Description
    Random random

    This .

    System.Int64 start

    The inclusive start.

    System.Int64 end

    The inclusive end.

    Returns
    Type Description
    System.Int64

    A random .

    | Improve this Doc View Source

    NextRealisticUnicodeString(Random)

    Returns random string of length between 0-20 codepoints, all codepoints within the same unicode block.

    Declaration
    public static string NextRealisticUnicodeString(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextRealisticUnicodeString(Random, Int32)

    Returns random string of length up to maxLength codepoints, all codepoints within the same unicode block.

    Declaration
    public static string NextRealisticUnicodeString(this Random random, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextRealisticUnicodeString(Random, Int32, Int32)

    Returns random string of length between min and max codepoints, all codepoints within the same unicode block.

    Declaration
    public static string NextRealisticUnicodeString(this Random random, int minLength, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 minLength
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextRecasedString(Random, String)

    Randomly upcases, downcases, or leaves intact each code point in the given string.

    Declaration
    public static string NextRecasedString(this Random random, string str)
    Parameters
    Type Name Description
    Random random
    System.String str
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextRegex(Random)

    Returns a valid (compiling) instance with random stuff inside. Be careful when applying random patterns to longer strings as certain types of patterns may explode into exponential times in backtracking implementations (such as Java's).

    Declaration
    public static Regex NextRegex(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    Regex
    | Improve this Doc View Source

    NextRegexishString(Random)

    Returns a thats "regexish" (contains lots of operators typically found in regular expressions) If you call this enough times, you might get a valid regex!

    Declaration
    public static string NextRegexishString(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextRegexishString(Random, Int32)

    Returns a thats "regexish" (contains lots of operators typically found in regular expressions) If you call this enough times, you might get a valid regex!

    Note: to avoid practically endless backtracking patterns we replace asterisk and plus operators with bounded repetitions. See LUCENE-4111 for more info.

    Declaration
    public static string NextRegexishString(this Random random, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 maxLength

    A hint about maximum length of the regexpish string. It may be exceeded by a few characters.

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextSimpleString(Random)

    Returns a random string consisting only of lowercase characters 'a' through 'z', between 0 and 20 characters in length.

    Declaration
    public static string NextSimpleString(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextSimpleString(Random, Int32)

    Returns a random string consisting only of lowercase characters 'a' through 'z'.

    Declaration
    public static string NextSimpleString(this Random random, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextSimpleString(Random, Int32, Int32)

    Returns a random string consisting only of lowercase characters 'a' through 'z'.

    Declaration
    public static string NextSimpleString(this Random random, int minLength, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 minLength
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextSimpleStringRange(Random, Char, Char, Int32)

    Returns a random string consisting only of characters between minChar and maxChar.

    Declaration
    public static string NextSimpleStringRange(this Random random, char minChar, char maxChar, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Char minChar
    System.Char maxChar
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextSingle(Random)

    Generates a random .

    Declaration
    public static float NextSingle(this Random random)
    Parameters
    Type Name Description
    Random random

    This .

    Returns
    Type Description
    System.Single

    A random .

    | Improve this Doc View Source

    NextSubString(Random, Int32, Boolean)

    Declaration
    public static string NextSubString(this Random random, int wordLength, bool simple)
    Parameters
    Type Name Description
    Random random
    System.Int32 wordLength
    System.Boolean simple
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextUnicodeString(Random)

    Returns random string, including full unicode range.

    Declaration
    public static string NextUnicodeString(this Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextUnicodeString(Random, Int32)

    Returns a random string up to a certain length.

    Declaration
    public static string NextUnicodeString(this Random random, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    NextWhitespace(Random, Int32, Int32)

    Returns a random string in the specified length range consisting entirely of whitespace characters.

    Declaration
    public static string NextWhitespace(this Random random, int minLength, int maxLength)
    Parameters
    Type Name Description
    Random random
    System.Int32 minLength
    System.Int32 maxLength
    Returns
    Type Description
    System.String
    See Also
    WHITESPACE_CHARACTERS
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)