Index: tests/lib/math/random_secure_test.dart |
diff --git a/tests/lib/math/random_secure_test.dart b/tests/lib/math/random_secure_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..22bb48cef3ba704d17ebc6e60ffe2bdb6f471e3f |
--- /dev/null |
+++ b/tests/lib/math/random_secure_test.dart |
@@ -0,0 +1,23 @@ |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// Library tag to allow Dartium to run the test. |
+library random_secure; |
+ |
+import "package:expect/expect.dart"; |
+import 'dart:math'; |
+ |
+main() { |
+ var results = []; |
+ for(var i = 0; i < 10; i++) { |
+ var rng = new Random.secure(); |
+ var intVal = rng.nextInt(10000000); |
+ Expect.isFalse(results.contains(intVal)); |
Lasse Reichstein Nielsen
2015/10/14 11:08:45
This is not a test of randomness.
It's just a flak
regis
2015/10/14 20:22:36
Acknowledged.
I just copied code from random_big_t
|
+ results.add(intVal); |
+ var doubleVal = rng.nextDouble(); |
+ Expect.isFalse(results.contains(doubleVal)); |
Lasse Reichstein Nielsen
2015/10/14 11:08:46
I wouldn't check doubles in the same loop as the i
regis
2015/10/14 20:22:36
Done.
|
+ results.add(doubleVal); |
+ rng.nextBool(); |
+ } |
Lasse Reichstein Nielsen
2015/10/14 11:08:46
Basically, there is no need to make a new test. Us
regis
2015/10/14 20:22:35
One existing test checks that the sequence is dete
|
+} |