From 9e03630b3c2770462fd301b164048617c1e26f1c Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 18 Oct 2016 17:23:50 -0700 Subject: [PATCH] Ensure uniqueness for unique-id(). --- lib/src/functions.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/functions.dart b/lib/src/functions.dart index 5484b430..fa130909 100644 --- a/lib/src/functions.dart +++ b/lib/src/functions.dart @@ -878,7 +878,7 @@ void defineCoreFunctions(Environment environment) { environment.defineFunction("unique-id", "", (arguments) { // Make it difficult to guess the next ID by randomizing the increase. - _uniqueID += _random.nextInt(36); + _uniqueID += _random.nextInt(36) + 1; if (_uniqueID > math.pow(36, 6)) _uniqueID %= math.pow(36, 6); // The leading "u" ensures that the result is a valid identifier. return new SassString("u${_uniqueID.toRadixString(36).padLeft(6, '0')}");