Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
fast_random.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/fast_random.h
10
//! @brief Helpers to work with random numbers.
11
12
#ifndef ROC_CORE_FAST_RANDOM_H_
13
#define ROC_CORE_FAST_RANDOM_H_
14
15
#include "
roc_core/stddefs.h
"
16
17
namespace
roc
{
18
namespace
core
{
19
20
//! Get a random integer from a non cryptographically secure, but fast PRNG.
21
//! Thread-safe.
22
//! @returns random value between 0 and UINT32_MAX.
23
uint32_t
fast_random
();
24
25
//! Get a random integer from a non cryptographically secure, but fast PRNG.
26
//! Thread-safe.
27
//! @returns random value in inclusive range [from; to].
28
uint32_t
fast_random_range
(uint32_t from, uint32_t to);
29
30
//! Get a random double from a non cryptographically secure, but fast PRNG.
31
//! Thread-safe.
32
//! @returns normally distibure random value with 1 variance.
33
double
fast_random_gaussian
();
34
35
}
// namespace core
36
}
// namespace roc
37
38
#endif
// ROC_CORE_FAST_RANDOM_H_
roc::core
General-purpose building blocks and platform abstraction layer.
roc::core::fast_random
uint32_t fast_random()
Get a random integer from a non cryptographically secure, but fast PRNG. Thread-safe.
roc::core::fast_random_range
uint32_t fast_random_range(uint32_t from, uint32_t to)
Get a random integer from a non cryptographically secure, but fast PRNG. Thread-safe.
roc::core::fast_random_gaussian
double fast_random_gaussian()
Get a random double from a non cryptographically secure, but fast PRNG. Thread-safe.
roc
Root namespace.
stddefs.h
Commonly used types and functions.
roc_core
fast_random.h
Generated by
1.17.0