Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Library tag to allow Dartium to run the test. | |
| 6 library random_secure; | |
| 7 | |
| 8 import "package:expect/expect.dart"; | |
| 9 import 'dart:math'; | |
| 10 | |
| 11 main() { | |
| 12 var results = []; | |
| 13 for(var i = 0; i < 10; i++) { | |
| 14 var rng = new Random.secure(); | |
| 15 var intVal = rng.nextInt(10000000); | |
| 16 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
| |
| 17 results.add(intVal); | |
| 18 var doubleVal = rng.nextDouble(); | |
| 19 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.
| |
| 20 results.add(doubleVal); | |
| 21 rng.nextBool(); | |
| 22 } | |
|
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
| |
| 23 } | |
| OLD | NEW |