Randomly choose value between 1 and 10 with equal number of instances
Posted
by
user1723765
on Stack Overflow
See other posts from Stack Overflow
or by user1723765
Published on 2012-12-05T16:42:21Z
Indexed on
2012/12/05
17:03 UTC
Read the original article
Hit count: 142
r
I would like to generate 2000 random numbers between 1 and 10 such that for each random number I have the same number of instances.
In this case 200 for each number.
What should be random is the order in which it is generated.
I have the following problem:
I have an array with 2000 entries but not each with unique values, for example it starts like this:
11112233333333344445667777777777
and consists of 2000 entries.
I would like to generate random numbers and assign each UNIQUE value a separate random number but have an entry for each value
So my intended result would look like this:
original array: 11112233333333344445667777777777
random numbers: 33334466666666699991778888888888
© Stack Overflow or respective owner