fix oid sometimes being malformed
All checks were successful
Build / build (pull_request) Successful in 53s
Build / build (push) Successful in 1m33s

This commit is contained in:
Sainan 2025-04-25 11:09:48 +02:00
parent 5cce77f3c1
commit d69534f515
2 changed files with 5 additions and 1 deletions

View File

@ -99,6 +99,9 @@ export class CRng {
randomInt(min: number, max: number): number {
const diff = max - min;
if (diff != 0) {
if (diff < 0) {
throw new Error(`max must be greater than min`);
}
if (diff > 0x3fffffff) {
throw new Error(`insufficient entropy`);
}

View File

@ -246,7 +246,8 @@ const generateVendorManifest = (vendorInfo: IGeneratableVendorInfo): IVendorMani
.toString(16)
.padStart(8, "0") +
vendorInfo._id.$oid.substring(8, 16) +
((rng.randomInt(0, 0xffff) << 16) | rng.randomInt(0, 0xffff)).toString(16).padStart(8, "0")
rng.randomInt(0, 0xffff).toString(16).padStart(4, "0") +
rng.randomInt(0, 0xffff).toString(16).padStart(4, "0")
}
};
if (rawItem.numRandomItemPrices) {