@@ -59,6 +59,7 @@ namespace turi {
5959 return distribution_type (min, max)(m_rng);
6060 }
6161 };
62+
6263 template <>
6364 struct uniform <double > {
6465 typedef std::uniform_real_distribution<double > distribution_type;
@@ -132,7 +133,7 @@ namespace turi {
132133 * Generate a random number in the uniform real with range [min,
133134 * max) or [min, max] if the number type is discrete.
134135 */
135- template <typename NumType>
136+ template <typename NumType = uint32_t >
136137 inline NumType uniform (const NumType min, const NumType max,
137138 typename std::enable_if<std::is_integral<NumType>::value>::type* = nullptr ) {
138139
@@ -144,7 +145,7 @@ namespace turi {
144145 /* *
145146 * Generate a random number in the uniform real with range [min,
146147 * max) or [min, max] if the number type is discrete.
147- * [Double overload]
148+ * [Float overload]
148149 */
149150 template <typename NumType>
150151 inline NumType uniform (const NumType min, const NumType max,
@@ -155,14 +156,6 @@ namespace turi {
155156 return d (m_rng);
156157 } // end of uniform
157158
158- /* *
159- * Generate a random number in the uniform real with range [min,
160- * max) or [min, max] if the number type is discrete.
161- */
162- template <typename NumType>
163- inline NumType fast_uniform (const NumType min, const NumType max) {
164- return uniform<NumType>(min, max);
165- }
166159
167160 /* *
168161 * Generate a random number in the uniform real with range [min,
@@ -379,18 +372,6 @@ namespace turi {
379372 return get_source ().uniform <NumType>(min, max);
380373 } // end of uniform
381374
382- /* *
383- * \ingroup random
384- * Generate a random number in the uniform real with range [min,
385- * max) or [min, max] if the number type is discrete.
386- */
387- template <typename NumType>
388- inline NumType fast_uniform (const NumType min, const NumType max) {
389- if (min == max) return min;
390- return get_source ().fast_uniform <NumType>(min, max);
391- } // end of uniform
392-
393-
394375 /* *
395376 * \ingroup random
396377 * Generate a random number between 0 and 1
@@ -401,7 +382,7 @@ namespace turi {
401382 * \ingroup random
402383 * Simulates the standard rand function as defined in cstdlib
403384 */
404- inline int rand () { return uniform (0 , RAND_MAX); }
385+ inline int rand () { return uniform< int > (0 , RAND_MAX); }
405386
406387
407388 /* *
0 commit comments