[Rails] I need to run some code only 40% of the times, how may i do this?
i need to make some square items, and there can be a max of 5 per row, and a min of 1 per row. then i want to have a row with 2 boxes, 5boxe, 1 box and so on, random… the last box of the row, will have a clear:both class..
Generate a random number between 0.0 and 1.0 for instance and check if it’s less than or equal to 0.4.