Add _stdlib_random for more platforms (#1)

* Remove refs to Countable ranges

* Add `_stdlib_random` for more platforms

* Use `getrandom` (if available) for Android, Cygwin

* Reorder the `_stdlib_random` functions

* Also include <features.h> on Linux

* Add `#error TODO` in `_stdlib_random` for Windows

* Colon after Fatal Error

Performance improvement for Random

gybify ranges

Fix typo in 'basic random numbers'
Add _stdlib_random as a testable method

Switch to generic constraints

Hopefully link against bcrypt

Fix some implementation details

1. Uniform distribution is now uniform
2. Apply Jens' method for uniform floats

Fix a lineable attribute
This commit is contained in:
Ben Rimmington
2018-02-10 00:09:14 +00:00
committed by Azoy
parent d23d219e95
commit a5df0ef83d
11 changed files with 342 additions and 183 deletions

View File

@@ -15,7 +15,7 @@ RandomTests.test("basic random numbers") {
let randomDouble1 = Double.random(in: 0 ..< 1)
expectTrue(randomDouble1 < 1 && randomDouble1 >= 0)
let randomDouble2 = Double.random(in: 0 ..< 1)
expectTrue(randomDouble1 < 1 && randomDouble2 >= 0)
expectTrue(randomDouble2 < 1 && randomDouble2 >= 0)
expectTrue(randomDouble1 != randomDouble2)
}