Skip to content

Commit 6cea4f3

Browse files
committed
fix: #3482 a BigInt related error when loading in specific environments
1 parent de7865c commit 6cea4f3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# History
22

3+
# unpublished changes since 14.5.0
4+
5+
- Fix: #3482 mathjs throwing an error related to `BigInt` when loading in
6+
specific environments.
7+
38
# 2025-05-21, 14.5.0
49

510
- Feat: improve the performance of the `map` and `forEach` methods of

src/function/probability/randomInt.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { isMatrix } from '../../utils/is.js'
66
const name = 'randomInt'
77
const dependencies = ['typed', 'config', 'log2', '?on']
88

9-
const simpleCutoff = 2n ** 30n
10-
119
export const createRandomInt = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, log2, on }) => {
1210
// seeded pseudo random number generator
1311
let rng = createRng(config.randomSeed)
@@ -70,6 +68,7 @@ export const createRandomInt = /* #__PURE__ */ factory(name, dependencies, ({ ty
7068
}
7169

7270
function _randomBigint (min, max) {
71+
const simpleCutoff = 2n ** 30n
7372
const width = max - min // number of choices
7473
if (width <= simpleCutoff) { // do it with number type
7574
return min + BigInt(_randomInt(0, Number(width)))

0 commit comments

Comments
 (0)