1

I'm using the less mixin which generate a random number, here is the code:

div{
 background:#FCFCFC;
 margin: 0;
 width : @random;
}

The problem here is that the @random variable increase more than it should. I even tried to limit it but then it mess with layout more.

Is there a way constraint the range on @random?

  • 1
    Not sure what mixin you were using, but [my solution on this SO answer](http://stackoverflow.com/questions/19869023/generate-random-number-in-less-css/19870741#19870741) allows you to set minimum and maximum range. – ScottS Feb 13 '14 at 18:48

1 Answers1

0

you can check @random max limit as

.max(@number) when (@number > yourMaxLimit ) {
   @random : yourMaxLimit 
 }

where yourMaxLimit it should be maximum value for @random it will set @random to your limit value when exceed the limit.

hope this help.