Random Range Feature

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Random Range Feature

Post by Rain » Tue Dec 07, 2010 7:08 pm

How about something like this if possible.

Random>{500, 1000},Result

Result would return a random number between 500 and 1,000.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 08, 2010 7:39 am

Is this no good?

Random>500,Result
Let>Result=Result+500
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Thu Dec 09, 2010 3:08 pm

Thank you for taking the time reading my post, Marcus.
Your example works just fine. That's what I've been doing all this time. Well, I use the Add function instead of Let.

I was just thinking that the ability to set the random range inside the random function would eliminate the extra line of code plus less typing for us lazy folks :lol:


Again, thanks for reading my post.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Dec 09, 2010 3:30 pm

Why don't you make a subroutine:

Code: Select all

GoSub>RandomRange,500,1000
MessageModal>RandomRange_Result

SRT>RandomRange
  Let>ZeroedRange=RandomRange_Var_2-RandomRange_Var_1
  Random>ZeroedRange,RandomRange_Result
  Let>RandomRange_Result=RandomRange_Result+RandomRange_Var_1
End>RandomRange
Wack that subroutine into an Include file or something and then in future you will save all that extra typing ;-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts