Skip to content

Commit e80abed

Browse files
authored
fix: random seed
1 parent 787b48b commit e80abed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libs/singly-list/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "./main.h"
22

3+
#include <time.h>
4+
35
#include "../macros.h"
46

57
// Private methods
@@ -150,6 +152,8 @@ void randomSortSList(SList* _list) {
150152

151153
if (length == 1) return;
152154

155+
srand(time(NULL));
156+
153157
if (length == 2) {
154158
rndIndex = rand() % length;
155159
if (rndIndex == index) return;

0 commit comments

Comments
 (0)