[vlc-devel] [PATCH 14/19] rand: move documentation to vlc_rand.h

Kartik Ohri kartikohri13 at gmail.com
Thu Jul 23 15:18:29 CEST 2020


From: rustyc <amcap1712 at gmail.com>

Move documentation for VLC API methods vlc_drand48,
vlc_lrand48 and vlc_mrand48 from src/misc/rand.c to
include/vlc_rand.h.
---
 include/vlc_rand.h | 30 ++++++++++++++++++++++++++++++
 src/misc/rand.c    | 27 ---------------------------
 2 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/include/vlc_rand.h b/include/vlc_rand.h
index 7adc32e483..db1cc235ec 100644
--- a/include/vlc_rand.h
+++ b/include/vlc_rand.h
@@ -29,8 +29,38 @@
 VLC_API void vlc_rand_bytes(void *buf, size_t len);
 
 /* Interlocked (but not reproducible) functions for the POSIX PRNG */
+
+/**
+ * PRNG uniformly distributed between 0.0 and 1.0 with 48-bits precision.
+ *
+ * @note Contrary to POSIX drand48(), this function is thread-safe.
+ * @warning Series generated by this function are not reproducible.
+ * Use erand48() if you need reproducible series.
+ *
+ * @return a double value within [0.0, 1.0] inclusive
+ */
 VLC_API double vlc_drand48(void) VLC_USED;
+
+/**
+ * PRNG uniformly distributed between 0 and 2^32 - 1.
+ *
+ * @note Contrary to POSIX lrand48(), this function is thread-safe.
+ * @warning Series generated by this function are not reproducible.
+ * Use nrand48() if you need reproducible series.
+ *
+ * @return an integral value within [0.0, 2^32-1] inclusive
+ */
 VLC_API long vlc_lrand48(void) VLC_USED;
+
+/**
+ * PRNG uniformly distributed between -2^32 and 2^32 - 1.
+ *
+ * @note Contrary to POSIX mrand48(), this function is thread-safe.
+ * @warning Series generated by this function are not reproducible.
+ * Use jrand48() if you need reproducible series.
+ *
+ * @return an integral value within [-2^32, 2^32-1] inclusive
+ */
 VLC_API long vlc_mrand48(void) VLC_USED;
 
 #endif
diff --git a/src/misc/rand.c b/src/misc/rand.c
index 56afa7e1e9..465b349bee 100644
--- a/src/misc/rand.c
+++ b/src/misc/rand.c
@@ -45,15 +45,6 @@ static void init_rand48 (void)
     }
 }
 
-/**
- * PRNG uniformly distributed between 0.0 and 1.0 with 48-bits precision.
- *
- * @note Contrary to POSIX drand48(), this function is thread-safe.
- * @warning Series generated by this function are not reproducible.
- * Use erand48() if you need reproducible series.
- *
- * @return a double value within [0.0, 1.0] inclusive
- */
 double vlc_drand48 (void)
 {
     double ret;
@@ -65,15 +56,6 @@ double vlc_drand48 (void)
     return ret;
 }
 
-/**
- * PRNG uniformly distributed between 0 and 2^32 - 1.
- *
- * @note Contrary to POSIX lrand48(), this function is thread-safe.
- * @warning Series generated by this function are not reproducible.
- * Use nrand48() if you need reproducible series.
- *
- * @return an integral value within [0.0, 2^32-1] inclusive
- */
 long vlc_lrand48 (void)
 {
     long ret;
@@ -85,15 +67,6 @@ long vlc_lrand48 (void)
     return ret;
 }
 
-/**
- * PRNG uniformly distributed between -2^32 and 2^32 - 1.
- *
- * @note Contrary to POSIX mrand48(), this function is thread-safe.
- * @warning Series generated by this function are not reproducible.
- * Use jrand48() if you need reproducible series.
- *
- * @return an integral value within [-2^32, 2^32-1] inclusive
- */
 long vlc_mrand48 (void)
 {
     long ret;
-- 
2.25.1



More information about the vlc-devel mailing list