how to get random numbers without repeating.
I tried something like this but numbers are repeating
Result
how to get random numbers without repeating.
I tried something like this but numbers are repeating
Result
(Updated/Edited) - I posted some blocks without testing and those blocks are not working, sorry for that. I edited this post.
This works perfectly…
Did you even try your code, as both looks weird to me…
I used Method 2 in my random generator app for remove used letters for scattergories.
@sonumohammad333 Your 1st method looks strange, and I just tested the second method, it is not working.
It will only work at first removal and on a couple of them it will remove the wrong index number and in the end it will show wrong list length
What should i do next.
Procedure to generate lists of numbers with these options:
Minimum
Maximum
How many numbers
Repeat or unique numbers
Sorted or unsorted
Sort order ascending or descending
What do i need to change in this blocks ?
What you are doing wrong is selecting random numbers from a fixed range (example 1 to 10, always).
You need to change that range every time a number is selected to create a “pool” of possible numbers. Example : Pool is 1,2,3,4,5,6,7,8,9,10. If 4 is selected, then remove it from the pool and next time it will not be possible to select it again.
We all showed you up there how to do that. You will have to adapt it to your project.
I edited my post. Now it works perfectly.
When that happens, it means you have to start the whole procedure from scratch. I would recommend that, since your procedure for selecting random numbers is not what you really need.
I am creating a quiz app with the help of quize extension, and I want that when the answer to the question arises from this extension, I want to show the numbers around that answer in four buttons, of which 1 will be the correct answer which will be generated by the extension and the remaining 3 options will be the numbers around that answer.
you might want to look into this App Inventor Tutorials and Examples: Advanced Features | Pura Vida Apps
Taifun
you might want to look into this App Inventor Tutorials and Examples: Advanced Features | Pura Vida Apps
[/quote]
I generated 4 possible answers, Now I have to show 4 options without repeating numbers, i am confused how can i do like this.
you already received several good answers…
start reading here again and implement what @Italo said
Taifun