By evamariav - 4/19/2017
Dear Inquisit-users,
I was wondering if anyone could help me with changing an expression. The expression as it is right now: t2_var = (round(rand(2*values.t2_bmax, 2*values.t2_tmax))/2) So what it does right now is randomly selecting a value within a range of changing bottom and top limits. By multiplying the limits with 2 and then dividing the amount by 2 it allows the value to be one within the range with increments of 0.5 However, I want the increments to be 5 and I am trying to figure out how to fix this. I figure it should be some sort of combination between the random selection of a value between those limits ((rand(values.t2_bmax, values.t2_tmax)) and the requirement that it must be one of these values: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95 (the limits are never lower than 0 and never higher than 100, that's why these are the only possible values).
Could someone help me with this? Thanks a lot in advance,
Eva
|
By Dave - 4/19/2017
+xDear Inquisit-users, I was wondering if anyone could help me with changing an expression. The expression as it is right now: t2_var = (round(rand(2*values.t2_bmax, 2*values.t2_tmax))/2) So what it does right now is randomly selecting a value within a range of changing bottom and top limits. By multiplying the limits with 2 and then dividing the amount by 2 it allows the value to be one within the range with increments of 0.5 However, I want the increments to be 5 and I am trying to figure out how to fix this. I figure it should be some sort of combination between the random selection of a value between those limits ((rand(values.t2_bmax, values.t2_tmax)) and the requirement that it must be one of these values: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95 (the limits are never lower than 0 and never higher than 100, that's why these are the only possible values). Could someone help me with this? Thanks a lot in advance, Eva Why not select a random value (integer) between 1 and 19 and multiply by 5? 1 * 5 = 5, 2 * 5 = 10, 3 * 5 = 15, ... 19 * 5 = 95.
I.e. assuming values.t2_bmax and values.t2_tmax also can only take on values in increments of 5,
t2_var = (round(rand(values.t2_bmax/5, values.t2_tmax/5))*5)
|
By evamariav - 4/21/2017
+x+xDear Inquisit-users, I was wondering if anyone could help me with changing an expression. The expression as it is right now: t2_var = (round(rand(2*values.t2_bmax, 2*values.t2_tmax))/2) So what it does right now is randomly selecting a value within a range of changing bottom and top limits. By multiplying the limits with 2 and then dividing the amount by 2 it allows the value to be one within the range with increments of 0.5 However, I want the increments to be 5 and I am trying to figure out how to fix this. I figure it should be some sort of combination between the random selection of a value between those limits ((rand(values.t2_bmax, values.t2_tmax)) and the requirement that it must be one of these values: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95 (the limits are never lower than 0 and never higher than 100, that's why these are the only possible values). Could someone help me with this? Thanks a lot in advance, Eva Why not select a random value (integer) between 1 and 19 and multiply by 5? 1 * 5 = 5, 2 * 5 = 10, 3 * 5 = 15, ... 19 * 5 = 95. I.e. assuming values.t2_bmax and values.t2_tmax also can only take on values in increments of 5, t2_var = (round(rand(values.t2_bmax/5, values.t2_tmax/5))*5) Thanks a lot! I already figured it out with a colleague of mine, but it is good to have our solution confirmed ;)
|
|