---
name: "SDL_srand"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_srand"
---

# SDL\_srand(3)

Seeds the pseudo-random number generator.

## NAME

SDL\_srand - Seeds the pseudo-random number generator.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**void SDL\_srand(Uint64 seed);**

## DESCRIPTION

Reusing the seed number will cause  **SDL\_rand** () to repeat the same stream of 'random' numbers.

## FUNCTION PARAMETERS

- *seed*

  the value to use as a random number seed, or 0 to use  **SDL\_GetPerformanceCounter** ().

## THREAD SAFETY

This should be called on the same thread that calls  **SDL\_rand** ()

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_rand**(3)](/SDL_rand/3.md), **•**(3), [**SDL\_rand\_bits**(3)](/SDL_rand_bits/3.md), **•**(3), [**SDL\_randf**(3)](/SDL_randf/3.md)
