mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user