<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/SystemRandomNumberGenerator/next()-2x0ly",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SGsE4nextqd__ys17FixedWidthIntegerRd__SURd__lF::SYNTHESIZED::s:s27SystemRandomNumberGeneratorV"
  },
  "title" : "next()"
}
-->

# next()

Returns a value from a uniform, independent distribution of binary data.

```
mutating func next<T>() -> T where T : FixedWidthInteger, T : UnsignedInteger
```

## Return Value

A random value of `T`. Bits are randomly distributed so that
every value of `T` is equally likely to be returned.

## Discussion

Use this method when you need random binary data to generate another
value. If you need an integer value within a specific range, use the
static `random(in:using:)` method on that integer type instead of this
method.

---

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)