SwiftRandom - Random data generator for swift

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SwiftRandom - Random data generator for swift

Demir B Yılmaz
https://github.com/thellimist/SwiftRandom


--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/2e3ff222-bad1-43f8-a4f9-9055a810df1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: SwiftRandom - Random data generator for swift

Swift Language mailing list
Your code for func random() -> Bool should really be


 public static func random() -> Bool {
        return Int.random(0, 1) == 0
    }

Also, why the arbitrary range of 0 … 100? Where practical, you should use the full range of integral types (bit of a problem for Int on OS X which is 64 bit) or probably 0 ..< 1 for floating point types.

And I think you should omit any dependency on UIKit. As it stands, a OS X developer can’t use your code without hacking bits out.

> On 12 Oct 2015, at 12:55, Demir B Yılmaz <[hidden email]> wrote:
>
> https://github.com/thellimist/SwiftRandom
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Swift Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/2e3ff222-bad1-43f8-a4f9-9055a810df1a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/E0CB5411-D7F0-4D03-A9B1-B39F98C3AF1F%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.