<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKARC4RandomSource/init(seed:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKARC4RandomSource(im)initWithSeed:"
  },
  "title" : "init(seed:)"
}
-->

# init(seed:)

Initializes a random source with the specified seed data.

```
init(seed: Data)
```

## Parameters

`seed`

A data object containing seed values for the random number generator.

## Return Value

A new, independent random source.

## Discussion

Any two random sources initialized with the same seed data will generate the same sequence of random numbers. To replicate the behavior of an existing [`GKARC4RandomSource`](/documentation/GameplayKit/GKARC4RandomSource) instance, read that instance’s [`seed`](/documentation/GameplayKit/GKARC4RandomSource/seed) property and then create a new instance by passing the resulting data to the [`init(seed:)`](/documentation/GameplayKit/GKARC4RandomSource/init(seed:)) initializer.

For a source of high-entropy seed data, see the <doc://com.apple.documentation/documentation/Security/SecRandomCopyBytes(_:_:_:)> function.

---

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)