Skip to content

Commit

Permalink
set seed
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Dec 4, 2020
1 parent aa3ab84 commit 679e401
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <sys/socket.h>
#include <sys/time.h>
#include <signal.h>
#include <time.h>

#include "main.h"

Expand Down Expand Up @@ -821,6 +822,7 @@ void c_show_cmd() {
static void shuffle(int *array, size_t n) {
if (n > 1) {
size_t i;
srand(time(NULL));
for (i = 0; i < n - 1; i++) {
size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
int t = array[j];
Expand Down

0 comments on commit 679e401

Please sign in to comment.