<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabularData",
  "identifier" : "/documentation/TabularData/RowGroupingProtocol/randomSplit(by:seed:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData19RowGroupingProtocolP11randomSplit2by4seedx_xtSd_SiSgtF"
  },
  "title" : "randomSplit(by:seed:)"
}
-->

# randomSplit(by:seed:)

Generates two row groupings by randomly splitting the original by a proportion.

```
func randomSplit(by proportion: Double, seed: Int?) -> (Self, Self)
```

## 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 two data row grouping types.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)