Talk:Dutch national flag problem: Difference between revisions

Line 14:
 
:That's a low probability event for any reasonably sized collection of balls, so I did it manually in the example. If you want it automatic, replacing ? with (3||.@/:)^:(-:/:~)@:? will work unless the user tries to generate a selection of only one random ball. [I fussed with that one a bit -- the issue behind my fussing was that I wanted a single correction step for all the improbable things that could go wrong in a random sort.] --[[User:Rdm|Rdm]] 00:58, 2 July 2012 (UTC)
 
::Hi, The Python is set up to generate a randomized, random sample of from one to five balls of each colour so it only has to check that the balls returned are not ordered. I don't read J code but I guess if you have the possibility of generating zero balls of a colour then the check would have to be for more? --[[User:Paddy3118|Paddy3118]] 06:29, 2 July 2012 (UTC)
Anonymous user