[Core] Add new switch_rand() a compliant random number generator API. Add a unit-test.

* [Core] Add new switch_rand() a compliant random number generator API. Add a unit-test.

* Fall back to rand() on unsupported platforms compile time.
This commit is contained in:
Andrey Volk
2024-06-06 21:05:33 +03:00
parent b84b7cbf71
commit c7e793c345
3 changed files with 83 additions and 0 deletions
+5
View File
@@ -1514,6 +1514,11 @@ SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, ch
SWITCH_DECLARE(char *) switch_must_strdup(const char *_s);
SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t *stream);
/**
/ Compliant random number generator. Returns the value between 0 and 0x7fff (RAND_MAX).
**/
SWITCH_DECLARE(int) switch_rand(void);
SWITCH_END_EXTERN_C
#endif
/* For Emacs: