Only prohibiting certain values to be randomly selected from a certain range


Only prohibiting certain values to be randomly selected from a certain...
Author
Message
evamariav
evamariav
Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)Associate Member (159 reputation)
Group: Forum Members
Posts: 2, Visits: 5
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



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search