jeudi 30 janvier 2020

How to Generate an Array of Random Number Sets in PHP? [duplicate]

I'm trying to figure out the best way to create an array of sets of randomly selected numbers from a range.

So, for instance:

I have a range of numbers from which to select: 1-100. I want to generate X number of sets of 5 of those numbers WITHOUT DUPLICATES.

So, I want to generate something like:

[3, 24, 32, 49, 68]

[2, 18, 43, 76, 98]

[10, 12, 23, 45, 67]

[5, 56, 64, 72, 90]

...

I know how to generate random numbers from a range once, I just am stuck on doing it X number of times without the possibility of duplicate sets.




Aucun commentaire:

Enregistrer un commentaire