Its possible, show random number without repeat?
Yes, when you generate a random number check it against a list of previously added random numbers, if it is in the list, generate again until your new random number is not in the list, then add it to the list! Store the list in the tinydb, or tinywebDB / cloudDB if required across app users.
Try this-
Oh sorry, I will edit it
Sorry @ TIMAI2 I don't understand your answer. Tell me the details. Thank you.
ok thanks,
This algorithm is more didactic to do with blocks, but if you want an extension to do it directly...
com.KIO4_Random.aix (6.8 KB)
Not Like This. I Have need show Single number. How Can I do This?
So set the random integer block like this-
random integer from 1 to 9
Oh Yes,
Sorry.....
One Use Laptop Others my Mobile. I remove One Account now.
Thank You.
@TIMAI2
Can you Help me? I Have need show Single Random number without repeat. How Can I do This?
Exm: I Select 1 to 10 Number for Random use.
When I Click button1, label 1 show single number from (1 to 10)
2nd click, 3rd click, 4th click......... 10th click = Label 1 show single number without repeat. when finessed random number output any Notice or others.
This technique depends on having a limit on the size of your random numbers, say 10...
- init a global list remaining_randoms as all numbers from 1 to limit.
- each button click, pick a random index from 1 to length of list remaining_randoms
- display the selected item from list remaining_randoms using that index
- remove the random index number from the remaining_randoms list
- if the remaining_randoms list is an empty list, disable the button.
The OP wanted to finish after all the numbers had been selected. A more complete example on that basis:
Thank's Everyone, I solve My Problem, Try this Link System.
https://puravidaapps.com/snippets.php#2removerandom
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.