Where are you defining your randomnumber function? If it's not in the same place as your set script then it won't be defined. You should be able to see the error in your browser console.
If you want to include additional global JavaScript functions, then you can put them in a separate .js file and include it using @import
- see http://docs.textadventures.co.uk/squiffy/import.html.
Alternatively you could add them to JavaScript's global window
object in a master section. Add it using this:
window.randomnumber = ...
instead of
var randomnumber = ...
Adding it to a master section ensures that the function will always be defined even when the game is reloaded. (If you only added it to the first section of a game, if the player reloads the browser tab, the initial section's JavaScript won't be re-run so you won't have the function defined globally any more).