We help IT Professionals succeed at work.
Get Started

'randomly' distributing elements into buckets

ugeb
ugeb asked
on
352 Views
Last Modified: 2012-05-11
Hi,

I have the task of placing users of a game into buckets based on their user ID.  The number of buckets is set for a given trial, but could vary from trial to trial.

For example, let's say I have 1000 users of a game, and I would like to place them randomly but evenly into 5 buckets, 1 through 5. However, whenever I compute the bucket for a given user, I always need to place them in the exact same bucket, so I need a deterministic way of 'randomly' placing a user in one of N buckets.  I would like each bucket to be representational of the whole data set.

Another follow on issue is that I have a certain % chance that they won't be placed in ANY bucket, but be left out of the experiment.  For example, maybe there's a 70% chance they will be placed in a bucket, and 30% chance they won't. If they ARE placed in a bucket, then I have to know which bucket.  It has to be repeatable for a given user.

Any suggestions on how I can approach this problem or on solutions already available?

Thanks!





Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015
Commented:
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE