Skip to content

Commit 44fb935

Browse files
authored
clang-tidy: resolve bugprone-random-generator-seed (#490)
* Disable `bupgrone-random-generator-seed` - Use of `srand()` is intentional simplicity of testing
1 parent d481f4b commit 44fb935

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# `clang-tidy` fixes report
2+
3+
1. `bugprone-*`
4+
5+
- [ ] bugprone-easily-swappable-parameters (41)
6+
- [ ] bugprone-exception-escape (3)
7+
- [ ] bugprone-implicit-widening-of-multiplication-result (11)
8+
- [ ] bugprone-macro-parentheses (398)
9+
- [ ] bugprone-multi-level-implicit-pointer-conversion (4)
10+
- [ ] bugprone-narrowing-conversions (34)
11+
- [x] [bugprone-random-generator-seed](https://github.com/Framework-R-D/phlex/pull/490) (1)
12+
- [ ] bugprone-reserved-identifier (1)
13+
- [ ] bugprone-return-const-ref-from-parameter (163)
14+
- [ ] bugprone-throwing-static-initialization (11)
15+
- [ ] bugprone-unchecked-optional-access (15)

test/form/writer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "toy_tracker.hpp"
88

99
#include <cstdlib>
10+
#include <ctime>
1011
#include <fstream>
1112
#include <iomanip>
1213
#include <iostream>
@@ -34,7 +35,8 @@ void generate(std::vector<float>& vrand, int size)
3435
int main(int argc, char** argv)
3536
{
3637
std::cout << "In main" << std::endl;
37-
srand(time(0));
38+
// Deliberately use C-style random number generation for simplicity in a test
39+
srand(time(nullptr)); // NOLINT(bugprone-random-generator-seed)
3840

3941
std::string const filename = (argc > 1) ? argv[1] : "toy.root";
4042
std::string const checksum_filename = (argc > 2) ? argv[2] : "toy_checksums.txt";

0 commit comments

Comments
 (0)