Abdulaziz93 Member Licensed User Longtime User Oct 17, 2013 #1 hi im trying to make a intger Variable to give me random numbers like this dim b as int i want b to give me a random number between 1-100 everytime random number and cant give it to me again *sorry about my bad english
hi im trying to make a intger Variable to give me random numbers like this dim b as int i want b to give me a random number between 1-100 everytime random number and cant give it to me again *sorry about my bad english
wy328 Member Licensed User Longtime User Oct 17, 2013 #2 you can make a sub with int type return value Upvote 0
Abdulaziz93 Member Licensed User Longtime User Oct 17, 2013 #3 wy328 said: you can make a sub with int type return value Click to expand... sorry i'm new how i can make it? Upvote 0
wy328 said: you can make a sub with int type return value Click to expand... sorry i'm new how i can make it?
Erel B4X founder Staff member Licensed User Longtime User Oct 17, 2013 #4 Code: Copy Dim b As Int = Rnd(1, 101) Upvote 0
eps Expert Licensed User Longtime User Oct 17, 2013 #5 What you're describing is not random behaviour . You would need to keep a record of the numbers returned to discard duplicates, but that would become harder to do. Upvote 0
What you're describing is not random behaviour . You would need to keep a record of the numbers returned to discard duplicates, but that would become harder to do.
Erel B4X founder Staff member Licensed User Longtime User Oct 17, 2013 #6 You need a "shuffle" solution: http://www.b4x.com/android/forum/threads/how-to-dont-repetition-random-number.13892/#post-78695 You can create an array with the numbers 1 to 100 and then shuffle it. Upvote 0
You need a "shuffle" solution: http://www.b4x.com/android/forum/threads/how-to-dont-repetition-random-number.13892/#post-78695 You can create an array with the numbers 1 to 100 and then shuffle it.
Abdulaziz93 Member Licensed User Longtime User Oct 19, 2013 #7 Erel said: You need a "shuffle" solution: http://www.b4x.com/android/forum/threads/how-to-dont-repetition-random-number.13892/#post-78695 You can create an array with the numbers 1 to 100 and then shuffle it. Click to expand... this is a good idea but i want the application so save it for the next time how i can make like this things? or i want it to save a edittext or something like that thanks <# Upvote 0
Erel said: You need a "shuffle" solution: http://www.b4x.com/android/forum/threads/how-to-dont-repetition-random-number.13892/#post-78695 You can create an array with the numbers 1 to 100 and then shuffle it. Click to expand... this is a good idea but i want the application so save it for the next time how i can make like this things? or i want it to save a edittext or something like that thanks <#
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2013 #8 Not sure that I completely understand. You can save the list with KeyValueStore. Upvote 0