mirror of https://github.com/PentHertz/srsLTE.git
Added random bit vector generator
This commit is contained in:
parent
bcb91d6173
commit
1f38817b3b
|
@ -39,6 +39,8 @@ SRSRAN_API float srsran_random_gauss_dist(srsran_random_t q, float std_dev);
|
|||
|
||||
SRSRAN_API bool srsran_random_bool(srsran_random_t q, float prob_true);
|
||||
|
||||
SRSRAN_API void srsran_random_bit_vector(srsran_random_t q, uint8_t* c, uint32_t nsamples);
|
||||
|
||||
SRSRAN_API void srsran_random_free(srsran_random_t q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -113,6 +113,13 @@ bool srsran_random_bool(srsran_random_t q, float prob_true)
|
|||
return srsran_random_uniform_real_dist(q, 0, 1) < prob_true;
|
||||
}
|
||||
|
||||
void srsran_random_bit_vector(srsran_random_t q, uint8_t* c, uint32_t nsamples)
|
||||
{
|
||||
for (uint32_t i = 0; i < nsamples; i++) {
|
||||
c[i] = (uint8_t)srsran_random_uniform_int_dist(q, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void srsran_random_free(srsran_random_t q)
|
||||
{
|
||||
if (q) {
|
||||
|
|
Loading…
Reference in New Issue