Tuesday, 15 February 2011

java - Algorithm need assistance -


I have some problems with the algorithm for my problem. I will try to explain to you the best I can. This is just an example.

Then say 3% people click on 3% link.

So I need an algorithm which will randomly expand one click on more than 1000 scenes.

It's easy to spread equally, eg: 1000 * .03 = 30, so every 30 ideas will click on a link.

Example:

 For  (i = 0; i    

  list & lt; Boolean & gt; WasClicked = new ArrayList & lt; Boolean & gt; (); (Int i = 0; i & lt; NUM_CLICKS * 0.03; i ++) {wasclicked.add (true); } (Int i = 0; i & lt; NUM_CLICKS * 0.97; i ++) {wasclicked.add (false)} collection. Shuffle (useless);   

You now have a random list of booleans, exactly 3% are true.

No comments:

Post a Comment