Comments for The Java Explorer
https://eyalsch.wordpress.com
Tips and insights on JavaSat, 08 Jul 2017 21:49:30 +0000hourly1http://wordpress.com/Comment on Taking Random Samples by Eyal Schneider
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-2032
Sat, 08 Jul 2017 21:49:30 +0000http://eyalsch.wordpress.com/?p=450#comment-2032Why? it will always return the complete list, as expected.
]]>Comment on Taking Random Samples by Anne van Rossum
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-2016
Sat, 01 Jul 2017 10:51:51 +0000http://eyalsch.wordpress.com/?p=450#comment-2016In Floyd’s algorithm if m=n, you have a problem.
]]>Comment on Parameters and returned values by Parth Pandit
https://eyalsch.wordpress.com/2010/02/11/refdamage/#comment-1425
Tue, 21 Jun 2016 19:31:53 +0000http://eyalsch.wordpress.com/?p=330#comment-1425Good article… Thanks a lot!
]]>Comment on Strings and Memory leaks by Lii
https://eyalsch.wordpress.com/2009/10/27/stringleaks/#comment-1141
Tue, 07 Jul 2015 12:34:34 +0000http://eyalsch.wordpress.com/?p=308#comment-1141Note that as of Java 1.7.0_06 (which was released 2012-08-14) the internal representation of strings changed and this does no longer apply. The substring method now makes a copy of the backing array instead of sharing it.
]]>Comment on A utility for multithreaded unit tests by Jonathan
https://eyalsch.wordpress.com/2010/07/13/multithreaded-tests/#comment-1116
Fri, 08 May 2015 20:51:28 +0000http://eyalsch.wordpress.com/?p=610#comment-1116You might check out ConcurrentUnit as well, which was created for testing these sort of scenarios: https://github.com/jhalterman/concurrentunit
]]>Comment on Taking Random Samples by huangjianyu
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-1106
Mon, 30 Mar 2015 02:22:04 +0000http://eyalsch.wordpress.com/?p=450#comment-1106Reblogged this on Always feel lonely.
]]>Comment on About by Greg
https://eyalsch.wordpress.com/about/#comment-1047
Thu, 11 Dec 2014 23:41:33 +0000#comment-1047Great java Quiz. Thanks.
]]>Comment on Taking Random Samples by Eyal Schneider
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-352
Sat, 08 Mar 2014 22:22:37 +0000http://eyalsch.wordpress.com/?p=450#comment-352The distribution is still even. The short proof in the post shows that any subset of size m has the same chance to be chosen.
Even the extreme case where the last m items are chosen has the same probability; it requires the first n-m items not to be chosen, so the probability is:
((n-m)/n) * ((n-1-m)/(n-1)) * ((n-2-m)/(n-2)) * … * (1/(m + 1)) = (n-m)! / (n! / m!) = 1 / C(n,m)
as required.
]]>Comment on Taking Random Samples by Dror A.
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-348
Wed, 05 Mar 2014 15:04:51 +0000http://eyalsch.wordpress.com/?p=450#comment-348Thanks for the quick reply! I noticed that point, and I assumed this is the key. However, it seems like it introduces another problem in terms of the even distribution? If `items.size()-visited` equals `m` then the missing elements will be picked sequentially until the quota is filled. Isn’t it harming the uniform distribution?
]]>Comment on Taking Random Samples by Eyal Schneider
https://eyalsch.wordpress.com/2010/04/01/random-sample/#comment-347
Wed, 05 Mar 2014 13:00:58 +0000http://eyalsch.wordpress.com/?p=450#comment-347Note that the probability to accept an item (#remaining to choose / #remaining) varies as you progress with the iteration. If m stops decreasing at some point, the iteration eventually reaches a position where the remaining items count (items.size() – visited) equals m. This makes the ratio 1.0, therefore all subsequent inclusion tests will be successful, and m will decrease accordingly until it reaches 0.
]]>