mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t5
This commit is contained in:
7
zrand.c
7
zrand.c
@@ -816,6 +816,7 @@ zsrand(CONST ZVALUE *pseed, CONST MATRIX *pmat55)
|
||||
RAND *ret; /* previous a55 state */
|
||||
CONST VALUE *v; /* value from a passed matrix */
|
||||
ZVALUE zscram; /* scrambled 64 bit seed */
|
||||
ZVALUE ztmp; /* temp holding value for zscram */
|
||||
ZVALUE seed; /* to hold *pseed */
|
||||
FULL shufxor[SLEN]; /* zshufxor as an 64 bit array of FULLs */
|
||||
long indx; /* index to shuffle slots for seeding */
|
||||
@@ -938,7 +939,9 @@ zsrand(CONST ZVALUE *pseed, CONST MATRIX *pmat55)
|
||||
for (i=A55-1; i > 0 && !zislezero(zscram); --i) {
|
||||
|
||||
/* determine what we will swap with */
|
||||
indx = zdivi(zscram, i+1, &zscram);
|
||||
indx = zdivi(zscram, i+1, &ztmp);
|
||||
zfree(zscram);
|
||||
zscram = ztmp;
|
||||
|
||||
/* do nothing if swap with itself */
|
||||
if (indx == i) {
|
||||
@@ -949,6 +952,8 @@ zsrand(CONST ZVALUE *pseed, CONST MATRIX *pmat55)
|
||||
SSWAP(a55, i, indx);
|
||||
}
|
||||
zfree(zscram);
|
||||
} else if (pseed != NULL) {
|
||||
zfree(zscram);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user