Display random number on page load

Thanks for this post, it’s really helpful.

Can you suggest a way of running the random number generator without having a click action.

What I want is for a random number to pop up in a modal window - maybe on load function - like this

For values from 1 - 50:

<script>document.write(Math.ceil(Math.random() * 49))</script>

For values from 0 - 49:

<script>document.write(Math.floor(Math.random() * 50))</script>

For values from 1 - 49:

<script>document.write(Math.floor(Math.random() * 50) + 1)</script>

or

<script>document.write(Math.ceil(Math.random() * 48))</script>

For values from 20 - 30:

<script>document.write(Math.floor(Math.random() * 11) + 20)</script>


Also, feel free to contact me for further code help and/or customization of third-party plugins

Thank you samliew, excellent examples, I will put them to good use…:clap::star::beer::1st_place_medal:

Just used the code works great!!!

Perfect! Works like a charm, Thank you