Kinda random pool but not really?
Hi Guys, can anyone tell me how to randomly select a number, (I can probably show it either as a graphic or as a digit on a counter on the playfield)from a pool of 120 such items. (They are not sequential whole numbers)Each time I show one, it gets removed from the pool. Thanx.
p.s. please, preferably no arrays, life is complicated enough. Maybe retrieve an item from a string? but then how do you eliminate the used item.... cheers Jafa
Re: Kinda random pool but not really?
What about the Random Pool object?
Re: Kinda random pool but not really?
How many items can I enter into that?
Re: Kinda random pool but not really?
As many as you want I think.
Re: Kinda random pool but not really?
I dont think you can use your own list of numbers? Rather you have to use the ones the machine generates for you, within the max and min range.
Re: Kinda random pool but not really?
yes, and whats wrong with that? Simply think of these numbers as ID's which you can link to whatever you want. Store your objects in a list or array and use the randomly generated number to refer to the object on that line for example.
Re: Kinda random pool but not really?
I have solved this before by having a list object with my pool of numbers. Then I randomly picked a line with a number and deleted it after use.
This works great if you are doing a pool of numbers but won't allow duplicates, or simulating a deck of cards that you need to draw from.
Re: Kinda random pool but not really?
Or Tetris, where each block needs to be used before the next set of 7.
Re: Kinda random pool but not really?
Side note: the new version of the random pool which is currently in development will allow you to add your own numbers to the pool.
Re: Kinda random pool but not really?
Re: Kinda random pool but not really?
Quote:
Originally Posted by Jacob
Or Tetris, where each block needs to be used before the next set of 7.
Tetris is random? One of the challenges is to be able to plan for multiple of the same coming in a row.
Re: Kinda random pool but not really?
Tetris is definitely random, though the original had a few flaws in its random generator that made it not "fair".
Many recent clones of tetris have attempted to make the game fair by using methods like "each block needs to be used before the next set of 7". Which does actually still allow duplicates, just only on the boundaries between each set of 7 blocks.