CalebJohn / joplin-math-mode

Turn your notes into a powerful calculator with inline math.
MIT License
65 stars 9 forks source link

use of random function #6

Closed tomhull closed 3 years ago

tomhull commented 3 years ago

Cool plugin, although trying to get a random number generator appears to be broken for me.

Using Joplin 1.7.11 and Math Mode v0.3.0

combinations(6, 3) // works fine
random([1]) // ok
random(1, 100)  // gives error:

Unexpected type of argument in function random (expected: number or Array or Matrix or string or boolean, actual: BigNumber, index: 0)

Expected behavior is a random number between 1 and 100 as per mathjs docs.

CalebJohn commented 3 years ago

Thanks for reporting this, this plugin uses mathjs's BigNumber by default. I hadn't realized how many functions this was broken for. I'll revert to regular numbers for the next point release. And leave BigNumbers as an option for those that want them.