Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: tests/lib/math/random_secure_test.dart

Issue 1398453004: Add a 'secure' constructor to Random in dart:math returning a cryptographically (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« sdk/lib/math/random.dart ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« sdk/lib/math/random.dart ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698