Skip to content

Commit 7c69d60

Browse files
committed
Minor documentation edits
1 parent 8640545 commit 7c69d60

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

selfsimilar_int_distribution.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*
3434
* The distribution of probability is such that the first (N*skew) elements are
3535
* generated (1-skew) of the times. This distribution also has the property
36-
* that the skew is the same within any region of the key space.
36+
* that the skew is the same within any region of the domain.
3737
*
3838
* Usage example:
3939
* #include <random>

zipfian_int_distribution.h

+13-11
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929

3030
/*
3131
* The zipfian_int_distribution class is intended to be compatible with other
32-
* distributions defined in #include<random> by the C++11 standard.
32+
* distributions introduced in #include <random> by the C++11 standard.
3333
*
3434
* Usage example:
3535
* #include <random>
3636
* #include "zipfian_int_distribution.h"
3737
* int main()
3838
* {
3939
* std::default_random_engine generator;
40-
* zipfian_int_distribution<int> distribution(1,10,0.99);
40+
* zipfian_int_distribution<int> distribution(1, 10, 0.99);
4141
* int i = distribution(generator);
4242
* }
4343
*/
@@ -46,23 +46,19 @@
4646
* IMPORTANT: constructing the distribution object requires calculating the zeta
4747
* value which becomes prohibetively expensive for very large ranges. As an
4848
* alternative for such cases, the user can pass the pre-calculated values and
49-
* avoid the calculation.
49+
* avoid the calculation every time.
5050
*
5151
* Usage example:
5252
* #include <random>
5353
* #include "zipfian_int_distribution.h"
5454
* int main()
5555
* {
5656
* std::default_random_engine generator;
57-
* zipfian_int_distribution<int>::param_type p(1,1e6, 0.99, 27.000);
57+
* zipfian_int_distribution<int>::param_type p(1, 1e6, 0.99, 27.000);
5858
* zipfian_int_distribution<int> distribution(p);
5959
* int i = distribution(generator);
6060
* }
6161
*/
62-
63-
0.99
64-
max_uint32_t --> 25.4095
65-
max_uint64_t -->
6662

6763
#include <cmath>
6864
#include <limits>
@@ -72,7 +68,7 @@
7268
template<typename _IntType = int>
7369
class zipfian_int_distribution
7470
{
75-
static_assert(std::is_integral<_IntType>::value, "template argument not an integral type");
71+
static_assert(std::is_integral<_IntType>::value, "Template argument not an integral type.");
7672

7773
public:
7874
/** The type of the range of the distribution. */
@@ -122,10 +118,16 @@ class zipfian_int_distribution
122118
double _M_zeta;
123119
double _M_zeta2theta;
124120

125-
double zeta(double n, double theta)
121+
/**
122+
* @brief Calculates zeta.
123+
*
124+
* @param __n [IN] The size of the domain.
125+
* @param __theta [IN] The skew factor of the distribution.
126+
*/
127+
double zeta(unsigned long __n, double __theta)
126128
{
127129
double ans = 0.0;
128-
for(int i=1; i<=n; ++i)
130+
for(unsigned long i=1; i<=n; ++i)
129131
ans += std::pow(1.0/i, theta);
130132
return ans;
131133
}

0 commit comments

Comments
 (0)