Contents

randomSplit(by:seed:)

Generates two generic arrays by randomly splitting the elements of the sequence.

Declaration

func randomSplit<T>(by proportion: Double, seed: Int? = nil) -> (ArraySlice<T>, ArraySlice<T>) where T == Self.Element

Parameters

  • proportion:

    A proportion in the range [0.0, 1.0].

  • seed:

    A seed number for a random-number generator.

Return Value

A tuple of array slices.