diff options
| author | Daniel Cerqueira <dan.git@lispclub.com> | 2025-07-12 09:00:30 +0100 |
|---|---|---|
| committer | Daniel Cerqueira <dan.git@lispclub.com> | 2025-07-12 09:00:30 +0100 |
| commit | d31744f0cc6c33ed24786aca8a01b8916aa82bbf (patch) | |
| tree | f9933047f217f80cd4e8a9281932023cbe7f51b7 | |
| parent | eda494e1747b9e96178b2c454bbfe9862df07158 (diff) | |
improve C of random
| -rw-r--r-- | liblali.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -948,15 +948,17 @@ Object *primitiveTime(Object **args, GC_PARAM) { } Object *primitiveRandom(Object **args, GC_PARAM) { - srandom((unsigned int)(seed + time(NULL))); - long nrandom = random(); - seed = (unsigned int)nrandom; - char string[22]; + srandom((unsigned int) (seed + time(NULL))); + long int nrandom = random(); + seed = (unsigned int) nrandom; + char string[22]; // 22 if (*args == nil) - sprintf(string, "+%ld", nrandom); + sprintf(string, "+%ld", (long int) nrandom); else - sprintf(string, "+%ld", nrandom % (atol((*args)->car->string) + 1)); + sprintf(string, "+%ld", + (long int) + (nrandom % (long int) (atol((*args)->car->string) + 1))); return newNumber(string, GC_ROOTS); } |
