Hi it says on the wiki that if i use (2700 + random(3000)) i should get a random value between 2700 and 3000 but i’m getting 4000 numbers. what am i doing wrong?
Random command issue?
random(x) will give you a number between 0 and x. Add that to the 2700 and you get a number between 2700 and 2700+x. Make x 300 and that is now 2700-3000
so if x was 400 it would be 4000?
would that also mean
if x was 30 it would be 300?
edit:
so how would you do between 0 and 3?
2700 + random(300) = 2700 + [0 … 300] = max value of 3000
2700 + random(1300) = 2700 + [0 … 1300] = max value of 4000
makes me even more confused
edit:
wait so its not between 2 numbers its 2700 + 300 so 2700 and 3000.
so 2500 + 500 would also be 3000
and that would mean my syntax of (2700 + random(3000)) actually ment between 2700 and 5700?
How about using random(min, max) instead? Just provide the min value you want and the max value. Forget about 2700 + …
For example, random(2700, 3000) would return random values between 2700 and 3000.
your edit is right on.
you do something like y + random(x) = z because you dont want the resulting value of z to be less than y. where y in this is 2700, which is often the lowest color temperature supported by a lot of connected bulbs.
Ok is that because its then a integra and the numbers are not in " " so then it means min and max? But if it was random(“2700”, “3000”) it would have picked one of the numbers? Because I also use random for text strings and then it picks a random one.
I have got it working now, with (2700 + random (300) ), I misunderstood the equation before. I thought from how I read the wiki that ment between 2700 and 300. Makes complete sense now, I did wonder what the + did
I will try the Min max one next time
It appears this does not work as intended. Will need to update webCoRE to allow min and max
I did try this earlier and it just did a random between just the 2 numbers so just used the other random function now i know how it works!