Is is there a way to insert a button to a PDF that would generate a random number (up to 10 numerical characters) but never repeat the same numbers for every time the button is clicked? Any help is appreciated.
Math.floor(Math.random() * 100);
What you really want is an alpha-numeric Universally Unique Identifier. You can find one of those here...
If you want the number not to repeat you will need to keep a record of all
previous numbers and compare the new number to it when generating it.
Care to elaborate?
Add a hidden text field and put each number you generate into it.
When generating a new number, compare it to the contents of that file. If a match is found, generate a new number, until you get a unique one. Then add it to the field as well, and repeat.
How do you compare the new number to the content of the file?
Is it possible to bypass the generate a new number until you get a unique one? Like, generate a new number that exclude those that have already been generated?
I only want to generate a random number from 1 to 8. If the first generated number is "5", then the next time I want to generate the number, the only choices would be 1, 2, 3, 4, 6, 7, 8.
Is that possible?
This is also possible.
I explained how to do it.... If you want me to write the code for you I'm happy to do it for a small fee. You can contact me privately (try6767 at gmail.com) to discuss it further.