]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(utils): swap getRandomFloat(Rounded) params to (min, max) for consistency...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 12 Jul 2026 12:42:29 +0000 (14:42 +0200)
committerGitHub <noreply@github.com>
Sun, 12 Jul 2026 12:42:29 +0000 (14:42 +0200)
commitbc003ccca94105bb04f45f8f044e07ec8e4fb351
treeab69c35b3a2d5f489ed9edee275a75fd1e017757
parentaa8e4026ba66fb00194b10f196df1abed63bdc45
refactor(utils): swap getRandomFloat(Rounded) params to (min, max) for consistency (#1998)

Swap getRandomFloat and getRandomFloatRounded params from (max, min[, scale]) to (min, max[, scale]) for consistency with the sibling bounds helpers randomInt (node:crypto) and isValidRandomIntBounds; migrate all 11 production + 5 test call sites; harmonize JSDoc across the random-float family.

Bundles a correctness fix: getRandomFloat now rejects a non-finite interval width (max - min), closing a latent overflow where finite endpoints such as (-MAX_VALUE, MAX_VALUE) returned Infinity/NaN, silently violating the documented [min, max] contract.

Internal API refactor: package.json exports only ./dist/start.js, so getRandomFloat is app-internal and this is not a semver-major public break.

Closes #1967
src/charging-station/ocpp/OCPPServiceUtils.ts
src/utils/Utils.ts
tests/utils/Utils.test.ts