This should now work in most J environments.

F=:52$'23456789TJQKA'
S=:13#u: 9824 9829 9830 9827
deck=:S,.F
shuf=: 13 :'<"2|."2 y {~ /:~"1 (|.x)$?~*/|.x

Save code above in a file and then run the script.
Here's how it looks in android.

13 4 shuf deck
┌──┬──┬──┬──┐
│♣A│♣J│♣K│♣9│
│♣Q│♣6│♣T│♣3│
│♦K│♣5│♣8│♦A│
│♦T│♣4│♣7│♦J│
│♦9│♣2│♦Q│♦8│
│♦6│♦2│♦7│♥K│
│♥A│♥Q│♦5│♥6│
│♥T│♥J│♦4│♥3│
│♥8│♥9│♦3│♠A│
│♥7│♥4│♠Q│♠K│
│♥5│♥2│♠T│♠9│
│♠8│♠J│♠7│♠6│
│♠5│♠2│♠3│♠4│
└──┴──┴──┴──┘

Linda

Sent from my Verizon, Samsung Galaxy smartphone
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to