Random Numbers - Using Javascript Math Library

I need to generate some random numbers. Shouldn't Math.random() be a part of the Javascript in Forms? I am getting the "Unexpected token" error. What do I need to do to be able to use Math?

Hello @smithme,

Please use the below code to get the random whole number.

fd.spRendered(function() {

console.log(Math.floor(Math.random() * 1000));

});
1 Like

I thought I had tried this but that must not be true because your code works just fine. This fixed my problem. Thank you.

1 Like