These were both bugs. Thanks for reporting them.
The problem with the currency function was that it didn't mark its output as valid LaTeX code, so when it's included in a LaTeX math expression, it's rendered as e.g. \textrm{$4}. The dollar sign is interpreted as opening a passage of math mode, and there's no matching dollar sign to close it. I've changed the function so that it marks its output as LaTeX, so it's inserted pretty much verbatim, with the dollar sign escaped.
The problem with the `random` function was floating-point precision, again. 8.45 - 8.15 can't be represented exactly, so it ends up as 0.2999999999999989 instead of 0.3. The code to pick randomly from a range uses this difference to work out how many possible values there are by rounding down to an integer. I've changed it to allow a tiny bit of error, so it now correctly generates 8.15, 8.25, 8.35 and 8.45.