Differences

This shows you the differences between two versions of the page.

 algorithm:fisher-yates_shuffle [2014/05/04 16:25]127.0.0.1 external edit algorithm:fisher-yates_shuffle [2015/02/02 08:28] (current) Both sides previous revision Previous revision 2015/01/29 23:00 will Title.2015/01/29 09:26 will 2014/07/05 22:40 will 2014/06/25 23:21 will 2014/05/04 16:25 external edit2013/05/04 15:58 will 2013/04/29 09:53 will 2013/04/22 20:00 will 2013/04/22 19:58 will 2013/04/22 19:57 will 2013/04/22 19:54 will 2013/04/22 19:53 will 2013/04/22 19:52 will 2013/04/20 22:38 will 2013/04/20 22:38 will 2013/04/20 22:37 will 2013/04/20 22:37 will 2013/04/20 22:36 will 2013/04/20 22:33 will 2012/10/04 21:59 external edit2012/10/02 22:24 will 2012/09/03 11:31 will 2012/08/31 22:00 will created Next revision Previous revision 2015/01/29 23:00 will Title.2015/01/29 09:26 will 2014/07/05 22:40 will 2014/06/25 23:21 will 2014/05/04 16:25 external edit2013/05/04 15:58 will 2013/04/29 09:53 will 2013/04/22 20:00 will 2013/04/22 19:58 will 2013/04/22 19:57 will 2013/04/22 19:54 will 2013/04/22 19:53 will 2013/04/22 19:52 will 2013/04/20 22:38 will 2013/04/20 22:38 will 2013/04/20 22:37 will 2013/04/20 22:37 will 2013/04/20 22:36 will 2013/04/20 22:33 will 2012/10/04 21:59 external edit2012/10/02 22:24 will 2012/09/03 11:31 will 2012/08/31 22:00 will created Line 1: Line 1: - [algorithm ​Fisher-Yates shuffle] + ======= λ Fisher-Yates shuffle ​====== - ====== Algorithm ====== + <​nowiki>​ + ======= Algorithm ​======= function shuffle(a) { function shuffle(a) { Line 13: Line 14: ​ - ====== Support ====== + ======= Support ​======= function swap(a, i, j) { function swap(a, i, j) { Line 23: Line 24: ​ - ====== Options ====== + ======= Tests ======= + + ​ + + ======= Options ​======= { { + "​title":"​Fisher-Yates shuffle",​ "​height":"​270px"​ "​height":"​270px"​ } } ​ - ====== Visualisation ====== + ======= Visualisation ​======= <​html>​ <​html>​ Line 72: Line 78: } } - function args() { + function args(forCloning) { - return a; + ​if (forCloning) { + var a2 = []; + for (var i=0, c=a.length; i​ +