1

I want:

let randomNumber = (1...10).sample

Specifically I only need this for Integers, but it would fun to know a general solution.

mxcl
  • 26,392
  • 12
  • 99
  • 98
  • 2
    This is not an exact duplicate of that question, though one of the provided answers to that question does coincidentally answer this question specifically for integers… but NOT for a general solution. So congratulations moderators, as usual you make me feel that StackOverflow is no longer a good place to ask questions. Instead you are closing valid questions for some ridiculous goal of "cleanliness” that you also in fact are not achieving. – mxcl Dec 04 '16 at 16:58

0 Answers0