prng.h(3)

📦
version 2.2.0 · 2 versions
, in fedora 44

✨ NAME ✨

prng.h — Генераторы псевдослучайных чисел 💖 aka the pseudo-random number generators header, and yes bestie this is the Library Functions Manual talking, so you know it's official ✨

It's literally the header that hands you three whole random-number vibes: COMBO, the echo-generator, and СТБ. 🎲🦋


🎀 SYNOPSIS 🎀

#include 'bee2/defs.h'

🫶 Функции (the functions, one by one)

  • size_t prngCOMBO_keep () — the state length of the COMBO functions 💅
  • void prngCOMBOStart (void *state, u32 seed) — initialize the COMBO generator
  • void prngCOMBOStepR (void *buf, size_t count, void *state) — the COMBO generator doing its little dance
  • size_t prngEcho_keep () — the state length of the echo-generator
  • void prngEchoStart (void *state, const void *seed, size_t seed_len) — initialize the echo-generator
  • void prngEchoStepR (void *buf, size_t count, void *state) — echo-generation, go off
  • size_t prngSTB_keep () — the state length of the СТБ generator
  • void prngSTBStart (void *state, const u16 z[31]) — initialize the СТБ generator
  • void prngSTBStepR (void *buf, size_t count, void *state) — using the СТБ generator

📖 DESCRIPTION 📖 (Подробное описание)

🍓 Генератор COMBO (the COMBO generator)

okay so the COMBO generator was developed by George Marsaglia — Дж. Марсалья, the icon himself (peep http://www.stat.fsu.edu/pub/diehard/cdrom/pscript/keynote.ps 👀). It passes all the tests in the DIEHARD battery, and the period of its state sequence is on the order of 2^60. no cap, that's a lot of randomness. 🔥

Working with COMBO is a two-step vibe: you call prngCOMBOStart() once, then you call prngCOMBOStepR() over and over forever (or until you're done, bestie). The state of the automaton is made up of prngCOMBO_keep() octets, and it's interpreted as the common stack of those functions. 💅

⚠️ The state must not be changed between calls to the functions. fr fr, don't touch it.

🦋 Эхо-генератор (the echo-generator)

The echo-generator just repeats the data buffer you handed it at initialization. It's the perfect little tool when you're testing and you need to push fixed data through the prng_i interface. it's giving "I'm the control group" energy 🌸

🧚 Генератор СТБ (the СТБ generator)

This generator is defined in СТБ 1176.2-99 (п. 7.2.2). Its output sequences are used when constructing prime numbers. 👑 primes only, periodt.


💖 FUNCTIONS 💖 (Функции)

size_t prngCOMBO_keep ()

Returns the length of the state of the functions that implement the COMBO generator.

Возвращает (Returns)

  • Глубина стека (the stack depth). 💅

void prngCOMBOStart (void * state, u32 seed)

The state of the COMBO generator gets initialized based on the number seed.

Предусловие (Precondition)

  • prngCOMBO_keep() octets of memory are reserved at the address state.

Аргументы (Arguments)

  • state — состояние COMBO (the COMBO state)
  • seed — инициализирующее значение (the initializing value)

void prngCOMBOStepR (void * buf, size_t count, void * state)

Pseudo-random octets built with the COMBO generator (state state) get written into the buffer [count]buf. The state state changes while generating. ✨

Ожидается (Expects)

  • prngCOMBOStart() < prngCOMBOStepR()*.

Прим. (Note)

  • The interface gen_i (defs.h) is supported.

Аргументы (Arguments)

  • buf — буфер (the buffer)
  • count — размер буфера (в октетах) (buffer size, in octets)
  • state — состояние COMBO (the COMBO state)

size_t prngEcho_keep ()

Returns the length of the state of the functions that implement the echo-generator.

Возвращает (Returns)

  • Длина состояния (the state length).

void prngEchoStart (void * state, const void * seed, size_t seed_len)

The state of the echo-generator gets initialized based on the buffer [seed_len]seed.

Предусловие (Precondition)

  • prngEcho_keep() octets are reserved at the address state.
  • seed_len > 0.
  • The buffer seed is correct.

Ожидается (Expects)

  • The buffer seed stays correct for the entire time you're working with the state state. 🫶 don't let it wander off.

Аргументы (Arguments)

  • state — состояние эхо-генератора (the echo-generator state)
  • seed — инициализирующий буфер (the initializing buffer)
  • seed_len — длина seed в октетах (length of seed, in octets)

void prngEchoStepR (void * buf, size_t count, void * state)

Octets built with the echo-generator (state state) get written into the buffer [count]buf. The state state changes while generating. 🌈

Ожидается (Expects)

  • prngEchoStart() < prngEchoStepR()*.

Прим. (Note)

  • The interface gen_i (defs.h) is supported.

Аргументы (Arguments)

  • buf — буфер (the buffer)
  • count — размер буфера (в октетах) (buffer size, in octets)
  • state — состояние (the state)

size_t prngSTB_keep ()

Returns the length of the state of the functions that implement the СТБ generator.

Возвращает (Returns)

  • Длина состояния (the state length).

void prngSTBStart (void * state, const u16 z[31])

The state of the СТБ generator gets initialized from the numbers of the array [31]z. If z is null, it's assumed that z[0] = 1, z[1] = 2,..., z[30] = 31. 🎀

Предусловие (Precondition)

  • prngSTB_keep() octets of memory are reserved at the address state.
  • If z != 0, then the buffer z is correct.
  • If z != 0, then z[i] > 0 && z[i] < 65257, i = 0, 1,..., 30.

Аргументы (Arguments)

  • state — состояние генератора (the generator state)
  • z — числа z[i] (the numbers z[i])

void prngSTBStepR (void * buf, size_t count, void * state)

Octets built with the СТБ generator (state state) get written into the buffer [count]buf. The state state changes while generating. 🔥

Ожидается (Expects)

  • prngSTBStart() < prngSTBStepR()*.

Прим. (Note)

  • The interface gen_i (defs.h) is supported.

Аргументы (Arguments)

  • buf — буфер (the buffer)
  • count — размер буфера (в октетах) (buffer size, in octets)
  • state — состояние (the state)

👑 AUTHOR 👑

Автоматически создано Doxygen для Библиотека Bee2 из исходного текста. — in other words, Doxygen auto-generated this for the Bee2 Library straight from the source text. not me being a little bot-authored baddie 💅✨


and that's the whole page, bestie — brought to you by Библиотека Bee2, dated Вс 25 Янв 2026 00:00:00, filed forever under prng.h(3). 🫶💖🎀 slay responsibly.

📦 where this page comes from