Skip to content

Commit 05ee32d

Browse files
authored
chore(formatting): apply code formatting for random session
1 parent 075c857 commit 05ee32d

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

random/random_init.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
template <typename T>
2-
T random(const T from, const T to) {
1+
template <typename T> T random(const T from, const T to) {
32
static random_device rdev;
43
static default_random_engine re(rdev());
54

6-
using dist_type = typename conditional<
7-
is_floating_point<T>::value,
8-
uniform_real_distribution<T>,
9-
uniform_int_distribution<T>
10-
>::type;
5+
using dist_type = typename conditional<is_floating_point<T>::value,
6+
uniform_real_distribution<T>,
7+
uniform_int_distribution<T>>::type;
118

129
dist_type uni(from, to);
1310
return static_cast<T>(uni(re));
14-
}
11+

random/random_permutation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
template<typename T>
2-
vector<T> random_permutation(int n, T start = 0) {
1+
template <typename T> vector<T> random_permutation(int n, T start = 0) {
32
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
43
vector<T> permutation(n);
54
iota(permutation.begin(), permutation.end(), start);
65
shuffle(permutation.begin(), permutation.end(), rng);
76
return permutation;
8-
}
7+
}

random/random_vector.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// random_init
22

3-
template<typename T>
4-
vector<T> random_vector(int n, T from, T to) {
3+
template <typename T> vector<T> random_vector(int n, T from, T to) {
54
vector<T> values(n);
6-
for(int i = 0; i < n; ++i) {
5+
for (int i = 0; i < n; ++i) {
76
values[i] = random<T>(from, to);
87
}
98
return values;
10-
}
9+
}

0 commit comments

Comments
 (0)