File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1071,16 +1071,16 @@ namespace Sass {
1071
1071
BUILT_IN (random)
1072
1072
{
1073
1073
Number* l = dynamic_cast <Number*>(env[" $limit" ]);
1074
- if (l && trunc (l->value ()) != l->value ()) error (" argument $limit of `" + string (sig) + " ` must be an integer" , pstate);
1075
1074
if (l) {
1075
+ if (trunc (l->value ()) != l->value () || l->value () == 0 ) error (" argument $limit of `" + string (sig) + " ` must be a positive integer" , pstate);
1076
1076
uniform_real_distribution<> distributor (1 , l->value () + 1 );
1077
1077
uint_fast32_t distributed = static_cast <uint_fast32_t >(distributor (rand));
1078
1078
return new (ctx.mem ) Number (pstate, (double )distributed);
1079
1079
}
1080
1080
else {
1081
1081
uniform_real_distribution<> distributor (0 , 1 );
1082
- uint_fast32_t distributed = static_cast <uint_fast32_t >(distributor (rand));
1083
- return new (ctx.mem ) Number (pstate, trunc ( distributed) );
1082
+ double distributed = static_cast <double >(distributor (rand));
1083
+ return new (ctx.mem ) Number (pstate, distributed);
1084
1084
}
1085
1085
}
1086
1086
You can’t perform that action at this time.
0 commit comments