Skip to content

Commit

Permalink
Linter ignore for rand() usage.
Browse files Browse the repository at this point in the history
Signed-off-by: Rule Timothy (CC/EMT2) <[email protected]>
  • Loading branch information
timrulebosch committed Dec 20, 2023
1 parent 9d07017 commit 9a7d4e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dse/modelc/examples/benchmark/benchmark_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: Apache-2.0

#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#include <assert.h>
#include <time.h>
#include <dse/modelc/model.h>
#include <dse/logger.h>

Expand All @@ -27,10 +27,10 @@ static size_t signal_count;

int generate_random_num(int lower, int upper)
{
static unsigned int seed = 0;
if (seed == 0) seed = time(0);
lower = upper/2 - 1;
int num = (rand_r(&seed) % (upper - lower )) + lower;
srand(time(0));
int num = (rand() % (upper - lower )) + lower; // NOLINT
// Alternative rand_r() not available in mingw.
return num;
}

Expand Down
1 change: 1 addition & 0 deletions tests/pytest/benchmark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ benchmark:
.PHONY: clean
clean:
rm -rf _out
rm -rf _working

0 comments on commit 9a7d4e6

Please sign in to comment.