I was not sure in which forum to place this question. So placed it in general java
I am working on a website. I've a requirement that says showing a newly added feature to a specidifed number of users.
Say 50%. So, if currently total userbase is 10,000 show this new feature to 5,000 people only. I want to achieve this programmatically.
How can I do that
Just a basic idea would suffice. Let me know if you need anyother info
Take the size of the whole userbase and check if the ID of the current user is in the first 27% (or 35%, or whatever you want). So only older users would be shown the new feature, of course. You could also check if the user ID is in the last n% (where n is your desired percentage). So only newer users would be able to use it. This is a quite simple approach, of course. I'm assuming you can't set a flag in the user itself.
Life is full of choices. Sometimes you make the good ones, and sometimes you have to kill all the witnesses.
Joined: Oct 14, 2008
For N% you could use
if ((userID % 100) < N)
(assuming that userIDs are uniformly distributed, of course)