SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Apprentice
    Join Date
    Jun 2007
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    randomnumdEr issue


    create a input parameter in action 1
    and from action call properties - Value configuration options window choose Random Number parameter from 0 to 100 with name arg_x

    in action 1 expert view type

    msgbox parameter("x")

    create action2
    in action 2 expert view type
    For i= 1 to 5
    Runaction "Action1", oniteration, randomnumber("arg_x")
    end



    Why in the msgbox it shows last 4 values as same. please help

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Location
    Cambridge, MA, USA
    Posts
    263
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: randomnumdEr issue

    Did you choose an option for the "Generate new random number" in the random number parameter options dialog?

  3. #3
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: randomnumdEr issue

    The problem is that a new random number is generated for each action iteration, but the parent action only has one iteration. Try the following:

    <font class="small">Code:</font><hr /><pre>
    Function GetRandom(ByVal min, ByVal max)
    Randomize
    GetRandom = (Int((max-min+1)*Rnd+min))
    End Function

    For i= 1 to 5
    Runaction "Action1", oniteration, GetRandom(0,100)
    Next
    </pre><hr />

  4. #4
    Junior Member
    Join Date
    Dec 2008
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: randomnumdEr issue

    this is Action Input Parameter for a Parameter value is a single value or befault value. we want to change that valu in runtime Any way here we give only single value we can't give the certain range of valus. so this not good Question .

  5. #5
    Junior Member
    Join Date
    Dec 2008
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: randomnumdEr issue

    Action 1
    ==================================
    'Expert view Script

    Msgbox Parameter("x")
    ' x is the Action1 Input Parameter default value is : 0

    Action 2
    =====================================
    'Expert view Script

    Function GetRandom(ByVal min, ByVal max)
    Randomize
    ' Usage of this it Generates Each and Every time Unique one
    GetRandom = (Int((max-min+1)*Rnd+min))
    End Function

    For i= 1 to 5
    Runaction "Action 1", oniteration, GetRandom(0,100)
    Next <font color="blue"> </font>

  6. #6
    Apprentice
    Join Date
    Jun 2007
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: randomnumdEr issue

    Thanks bpolitzer

    I know all other ways work fine. I was just curious to know why it is happening, the reason behind it.

    but what if I put Exitaction statement at the end of action1. then also it has same results.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:09 PM.

Copyright BetaSoft Inc.