Generating random numbers with decimal spaces

Skip to first unread message

Werner Cordier

Oct 6, 2021, 5:10:01 AMOct 6
to Numbas Users
Good afternoon all
I'm a bit new to NUMBAS, but have gotten my head wrapped around the basics of what I'll need it for. For some-or-another reason I can't seem to figure out how to generate a random number between two set ranges inclusive of decimal spaces. I've used random(1..10), however, it returns a whole number, while including dec() doesn't help at this stage and maintains an integer. Any assistance would be appreciated.

Ben Brawn

Oct 8, 2021, 6:59:40 PMOct 8
to Numbas Users
Use # to specify the increment size for the range.
e.g. random(1..10#0.3), or random(1..10#0.01) depending on what increments you want. You would also do random(1..10#2) for the odd numbers etc
Reply all
Reply to author
0 new messages