Random number generator (lottery)

@NishyanthKumar You need to handle the fact that your blocks do not guarantee 7 different/unique numbers....

1 Like

@TIMAI2, right, something I was maybe a little too oblivious to :weary:

1 Like

Also, using the join block as you do creates one long number, not 7 numbers.

2 Likes

This should be better:

1 Like

Closer, but still not correct.

Try something like this:

oops - see below

You may want to sort the numbers in the list after they have been generated.

2 Likes

This solution would leave you short of 7 numbers if you got any duplicates.

There are two solutions at

1 Like

Yes, left out a counter:

3 Likes

That is my designer... I hope u can understand my language. I'm from Slovenia but i think if u do this often u dont need translate... Text for label its just title...but just in case u need translate:
število=number
prvo=first
drugo= second,.....
generiraj števila=generate numbers

Try this: lottery_7.aia (11.9 KB)

grafik

2 Likes

where can i find call (puprple) block?

Or this:

1 Like

Get current millis using Clock component.
Somehow get last 7 digits.

I cant find call ListAddon1. bubbleSort list....i have only three purple blocks

grafik

1 Like

Hmm, for what purpose? How should that help?

To generate a random 7 digit unique number.
However, digits will not be unique, always.

And agan:

But 7 numbers between 1 - 100 are required, and not 7 digits.

3 Likes

Are there any other solutions for saving my problem, don't get me wrong your replays were solutions but i just wanna know diffrent ways if they are

probably hundreds, only limited by your imagination and creativity....