I using the less mixin which generate a random number within given range. here is the code:
.makeRandom(@min: 0, @max: @min+1) {
// Math.floor(Math.random() * (max - min + 1)) + min
@getNum: `(Math.floor(Math.random() * (@{max} - @{min} + 1)) + @{min})`;
}
and Calling in another mixin set animation on calling div:
.move (@left : 45% , @duration: 5s ,@delay : 2s) {
animation: moveUp @duration linear @delay infinite;
/* Safari and Chrome: */
-webkit-animation: moveUp @duration linear @delay infinite ;
.makeRandom(100, 400);
margin-left: unit(@getNum ,'px');
}
but I am getting this error
SyntaxError: error evaluating function
unit
: the first argument to unit must be a number
when I tried to change the unit. how can I changed unit of @getnum?