Click to random page

Hello. I want to make a click so that he leads to a random page. Pages that I choose.

Use the following javascript code to get number from 1 to 10:

Math.floor(Math.random() * 10) + 1

image

See the example goto_random_page.pma (928.9 KB)

Thank You. I’ll try)

And one more question. How can I combine these two ways ??

function () {
if (document.inactivity > 2 && document.currentPageNumber == 2)
return 3
}

AND

Math.floor(Math.random() * 10) + 1

function () {
   if (document.inactivity > 2 && document.currentPageNumber == 2)
      return Math.floor(Math.random() * 10) + 1
}
1 Like

how about generating non repeating values?
exxample
1,5,7
sometimes program might generate 1,1,5

Can you describe your task in more detail?

Anyway it is just JavaScript and there are many examples: https://www.google.com/search?q=javascript+random+no+repeat

1 Like

Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.