1 /* 2 * Copyright 2018 Oticon A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef BS_RAND_MAIN_H 7 #define BS_RAND_MAIN_H 8 9 #include "bs_types.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 #define RAND_PROB_1 RAND_MAX 16 17 int bs_random_init(unsigned int seed); 18 void bs_random_free(void); 19 double bs_random_Gaus(void); 20 21 #ifdef complex 22 //Only for those who have included <complex.h>: 23 double complex bs_random_Gaus_c(); 24 void bs_random_Gaus_c_buffer(double complex* buffer, uint size); 25 #endif 26 27 double bs_random_GPRND(double k, double sigma, double theta); 28 29 char bs_random_bit(void); 30 double bs_random_uniform(void); 31 double bs_random_uniformR(double a, double b); 32 int bs_random_uniformRi(int a, int b); 33 uint32_t bs_random_uint32(void); //This function is deprecated and buggy 34 void bs_random_buffer(char *buffer, size_t size); 35 36 uint bs_random_Binomial(uint n, uint32_t probability); 37 38 #ifdef __cplusplus 39 } 40 #endif 41 42 #endif 43