Scroll to navigation

SDL_srand(3) SDL3 FUNCTIONS SDL_srand(3)

NAME

SDL_srand - Seeds the pseudo-random number generator.

SYNOPSIS

#include <SDL3/SDL_stdinc.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

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

SDL_rand(3), SDL_rand_bits(3), SDL_randf(3)

SDL 3.2.14 Simple Directmedia Layer