repositories
/
e-mobility-charging-stations-simulator.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f45578
)
refactor(simulator): remove unneeded intermediate variable in helper
author
Jérôme Benoit
<jerome.benoit@sap.com>
Fri, 10 Feb 2023 11:52:44 +0000
(12:52 +0100)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Fri, 10 Feb 2023 11:52:44 +0000
(12:52 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/Utils.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/utils/Utils.ts
b/src/utils/Utils.ts
index ab2a8a5f26302bf23d52aa3bf0a21e407d29ace8..1f17fe8735dce9bb1b794075aefd318da22e06a9 100644
(file)
--- a/
src/utils/Utils.ts
+++ b/
src/utils/Utils.ts
@@
-128,8
+128,7
@@
export default class Utils {
if (max - min === Infinity) {
throw new RangeError('Invalid interval');
}
- const randomPositiveFloat = crypto.randomBytes(4).readUInt32LE() / 0xffffffff;
- return randomPositiveFloat * (max - min) + min;
+ return (crypto.randomBytes(4).readUInt32LE() / 0xffffffff) * (max - min) + min;
}
public static getRandomInteger(max = Constants.MAX_RANDOM_INTEGER, min = 0): number {