Skip to content

Commit 7cb95de

Browse files
committed
Merge pull request #677 from mgreter/bugfix/make-random-test-fault-tolerant
Make random test more fault tolerant
2 parents 58149fe + 73850e6 commit 7cb95de

File tree

1 file changed

+3
-3
lines changed
  • spec/libsass-closed-issues/issue_657/default

1 file changed

+3
-3
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
$values: ();
22

33
foo {
4+
$duplicates: 0;
45
$num: random();
56
$is-number: type-of($num) == number;
67
$is-within-range: $num >= 0 and $num < 1;
7-
$is-random: index($values, $num) == null;
88
$values: append($values, $num);
99

1010
@for $i from 1 through 1000 {
1111
$num: random();
1212
$is-number: $is-number and type-of($num) == number;
1313
$is-within-range: $is-within-range and $num >= 0 and $num < 1;
14-
$is-random: $is-random and index($values, $num) == null;
14+
@if (index($values, $num) != null) { $duplicates: $duplicates + 1; }
1515
$values: append($values, $num);
1616
}
1717

1818
is-defined: $num != "random()";
1919
is-number: $is-number;
2020
is-within-range: $is-within-range;
21-
is-random: $is-random;
21+
is-random: $duplicates < 25;
2222
}

0 commit comments

Comments
 (0)