FFmpeg
Data Structures | Functions
sfc64.h File Reference
#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  FFSFC64
 

Functions

static uint64_t ff_sfc64_get (FFSFC64 *s)
 
static uint64_t ff_sfc64_reverse_get (FFSFC64 *s)
 Return the previous random value, and step the generator backward. More...
 
static void ff_sfc64_init (FFSFC64 *s, uint64_t seeda, uint64_t seedb, uint64_t seedc, int rounds)
 Initialize sfc64 with up to 3 seeds. More...
 

Detailed Description

simple Pseudo Random Number Generator

This is a implementation of SFC64, a 64-bit PRNG by Chris Doty-Humphrey.

This Generator is much faster (0m1.872s) than 64bit KISS (0m3.823s) and PCG-XSH-RR-64/32 (0m2.700s) And passes testu01 and practrand test suits.

Definition in file sfc64.h.

Function Documentation

◆ ff_sfc64_get()

static uint64_t ff_sfc64_get ( FFSFC64 s)
inlinestatic

Definition at line 41 of file sfc64.h.

Referenced by doTest(), and ff_sfc64_init().

◆ ff_sfc64_reverse_get()

static uint64_t ff_sfc64_reverse_get ( FFSFC64 s)
inlinestatic

Return the previous random value, and step the generator backward.

It is safe to take values before the first, but such values can be highly correlated to the seeds.

Definition at line 55 of file sfc64.h.

◆ ff_sfc64_init()

static void ff_sfc64_init ( FFSFC64 s,
uint64_t  seeda,
uint64_t  seedb,
uint64_t  seedc,
int  rounds 
)
inlinestatic

Initialize sfc64 with up to 3 seeds.

Parameters
roundsnumber of rounds mixing up state during init. Generally 8-18, larger numbers will help with bad quality seeds. 12 is a good choice if all 3 seeds are equal

Definition at line 75 of file sfc64.h.

Referenced by main().