mirror of https://github.com/PentHertz/srsLTE.git
Added boolean random generator
This commit is contained in:
parent
f9c3dd2748
commit
7a20e3a51e
|
@ -25,6 +25,7 @@
|
|||
#include "srslte/config.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -45,6 +46,8 @@ srslte_random_uniform_complex_dist_vector(srslte_random_t q, cf_t* vector, uint3
|
|||
|
||||
SRSLTE_API float srslte_random_gauss_dist(srslte_random_t q, float std_dev);
|
||||
|
||||
SRSLTE_API bool srslte_random_bool(srslte_random_t q, float prob_true);
|
||||
|
||||
SRSLTE_API void srslte_random_free(srslte_random_t q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -117,6 +117,11 @@ float srslte_random_gauss_dist(srslte_random_t q, float std_dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool srslte_random_bool(srslte_random_t q, float prob_true)
|
||||
{
|
||||
return srslte_random_uniform_real_dist(q, 0, 1) < prob_true;
|
||||
}
|
||||
|
||||
void srslte_random_free(srslte_random_t q)
|
||||
{
|
||||
if (q) {
|
||||
|
|
Loading…
Reference in New Issue