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:
2f30779
)
Fix negative values in meter values
author
Jérôme Benoit
<jerome.benoit@sap.com>
Tue, 21 Sep 2021 16:29:42 +0000
(18:29 +0200)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Tue, 21 Sep 2021 16:29:42 +0000
(18:29 +0200)
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 3782beeb306148c90914b2de216b584b07311cbf..92373cf043ba2161426ae6066c3376ef53097af4 100644
(file)
--- a/
src/utils/Utils.ts
+++ b/
src/utils/Utils.ts
@@
-104,7
+104,7
@@
export default class Utils {
throw new RangeError('Invalid interval');
}
const randomPositiveFloat = crypto.randomBytes(4).readUInt32LE() / 0xffffffff;
- const sign = (negative && randomPositiveFloat < 0.5) ?
1 : -
1;
+ const sign = (negative && randomPositiveFloat < 0.5) ?
-1 :
1;
return sign * (randomPositiveFloat * (max - min) + min);
}