Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-24 Thread Edward Connell via swift-users
Thank you for all the feedback and options. In further investigation, I also ran across the family of xx48 rngs, which appear to be on both platforms. They claim to be uniformly distributed. drand48, erand48, jrand48, lcong48, lrand48, mrand48, nrand48, seed48, srand48

Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Jens Persson via swift-users
Check out the generators (especially xoroshiro) on this site: On Mon, May 22, 2017 at 6:54 PM, Saagar Jha via swift-users < swift-users@swift.org> wrote: > > Saagar Jha > > On May 22, 2017, at 08:44, Edward Connell via swift-users < > swift-users@swift.org> wrote: > > Any ideas when Foundation

Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Jens Persson via swift-users
Sorry for the premature send ... Here is the site: http://xoroshiro.di.unimi.it There is also a section there about "generating uniform doubles in unit interval" which is worth reading. And here's how to get uniform floating point values in the range [0, 1) from various (supposedly) random bit

Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Philippe Hausler via swift-users
arc4random_uniform is from Darwin not Foundation - it just happens to be in a header we import when you import Foundation. > On May 22, 2017, at 8:44 AM, Edward Connell via swift-users > wrote: > > Any ideas when Foundation on Linux will support arc4random_uniform? This

Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Daniel Dunbar via swift-users
This function isn't something which comes with Foundation, it is supplied by the BSD libraries on Darwin, but those aren't present on Linux. I recommend looking for a Swift implementation of a high-quality RNG which will meet your needs, rather than trying to rely on a non-portable

[swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Edward Connell via swift-users
Any ideas when Foundation on Linux will support arc4random_uniform? This is kind of an important function. There doesn't seem to be any decent substitute without requiring the installation of libbsd-dev, which turns out to be messy. Currently I am doing this, but glibc random with mod does not