I have these value:
let previous = 170
let min = 100
let max = 800
So what I´m doing is that I´m generating a random number between min and max, with these rules:
minnot less than 100maxnot more than 800- I only want to have +200 from
previousor -200 fromprevious
So for the above example the random number should be between:
min: 100 and max 370.
Min is 100 because min can´t be less than 100 and max is basically previous: 170 + 200.
I tried the "pattern-match" operator ~=: but it did not feel like the right component to do here.
Any ideas of how to solve this?
Aucun commentaire:
Enregistrer un commentaire