From 170c0b495c475035b479513cb89390d4d27b8010 Mon Sep 17 00:00:00 2001 From: Robbert van Renesse Date: Wed, 31 Jan 2024 20:57:56 -0500 Subject: [PATCH] random --> rand for Windows compat --- harmony_model_checker/charm/charm.c | 6 +++--- harmony_model_checker/charm/ops.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/harmony_model_checker/charm/charm.c b/harmony_model_checker/charm/charm.c index 789c7412..6bfc2563 100644 --- a/harmony_model_checker/charm/charm.c +++ b/harmony_model_checker/charm/charm.c @@ -318,7 +318,7 @@ static void run_direct(struct state *state){ for (int i = 0; i < state->bagsize; i++) { total += state_multiplicity(state, i); } - unsigned int select = random() % total; + unsigned int select = rand() % total; // printf("--> %u %u\n", total, select); for (int i = 0; i < state->bagsize; i++) { if (state_multiplicity(state, i) > select) { @@ -342,7 +342,7 @@ static void run_direct(struct state *state){ // Check if an interrupt is in order if (cc->extended && ctx_trap_pc(cc) != 0 && !cc->interruptlevel) { interrupt_count += 1; - if (random() % interrupt_count == 0) { + if (rand() % interrupt_count == 0) { interrupt_invoke(&step); } } @@ -3672,7 +3672,7 @@ int exec_model_checker(int argc, char **argv){ // This is an experimental feature: run code directly (don't model check) if (dflag) { global.run_direct = true; - srandom((unsigned) gettime()); + srand((unsigned) gettime()); run_direct(state); exit(0); } diff --git a/harmony_model_checker/charm/ops.c b/harmony_model_checker/charm/ops.c index aae4a634..dd341ed5 100644 --- a/harmony_model_checker/charm/ops.c +++ b/harmony_model_checker/charm/ops.c @@ -744,7 +744,7 @@ void op_Choose(const void *env, struct state *state, struct step *step){ exit(1); } if (line[0] == '\n') { - unsigned int selection = random() % size; + unsigned int selection = rand() % size; ctx_push(step->ctx, vals[selection]); step->ctx->pc++; return;