random

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Unknown 2010
    Forum Member
    • Nov 2008
    • 35

    random

    hi

    Suppose that I have numbers: 1; 2; 3; 4; 5; 6; 7; .... 20
    I want to arrange their orders randomly and put them in a variable, EXAMPLE:
    5;8;6;10;20;7;..............

    When I click on the button I want to:
    * put the first number in input
    * remove the first number from the variable

    thanks
  • holtgrewe
    Indigo Rose Customer
    • Jul 2002
    • 779

    #2
    Here's a fairly quick example, not completely tested - but should give you some ideas...

    hth
    Attached Files

    Comment

    • Unknown 2010
      Forum Member
      • Nov 2008
      • 35

      #3
      Sorry, my explanation was not clear.

      In Input1 the numbers should be in random order 5;8;9;7;10;12;55;11;20;66
      When I click on the button the first number in input1 should be moved to input 2

      Thanks.

      Comment

      • holtgrewe
        Indigo Rose Customer
        • Jul 2002
        • 779

        #4
        The example should contain just about everything you need to get you started - experiment a little.
        I don't have time right now but post back if you still can't get it...

        Comment

        • presidente
          Forum Member
          • Jun 2008
          • 110

          #5
          Maybe this one helps you

          Lotto.apz

          there are three modes,
          generate 6 of 49
          generate 6 of 49, one number preselected
          generate 10 of 20

          you have to click on the eye to start random-generation.

          in the mode 10 of 20, the aplication code contents the sleep-command to looks better (generating number to number). so, if you want it to work more rapid, you have to delete the sleep commands.

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2496

            #6
            How many ways are there to do this ?? .

            I haven't looked at other offerings but this is what I cam up with -
            Code:
            --initialise some variables and a table 
            duplicate=false
            text=""
            max = 20
            tbl_numbers={}
            
            --populate the table elements 1 to max
            for count = 1, max do	
            tbl_numbers[count] = count;	
            end
            
            --now remove the table elements randomly 
            --one by one and build the string as we go.
            for remove = 1, max do
            newcount = Table.Count(tbl_numbers);
            current = Math.Random(1, newcount);
            text=text..tbl_numbers[current]..";"
            result = Table.Remove(tbl_numbers, current);
            end

            Comment

            • Unknown 2010
              Forum Member
              • Nov 2008
              • 35

              #7
              Could you make it as .am7 ?
              Last edited by Unknown 2010; 02-27-2009, 01:47 PM.

              Comment

              • Unknown 2010
                Forum Member
                • Nov 2008
                • 35

                #8
                I want a script to generate random list of number only

                Comment

                • longedge
                  Indigo Rose Customer
                  • Aug 2003
                  • 2496

                  #9
                  Originally posted by Unknown 2010 View Post
                  I want a script to generate random list of number only


                  Suppose that I have numbers: 1; 2; 3; 4; 5; 6; 7; .... 20
                  I want to arrange their orders randomly and put them in a variable, EXAMPLE:
                  5;8;6;10;20;7;..............
                  Did you try the code I suggested. It does exactly what you asked for.

                  Comment

                  • Unknown 2010
                    Forum Member
                    • Nov 2008
                    • 35

                    #10
                    I am newbie.

                    the code you put is generate the list after lots of clicking on the button.

                    I want to choose max number and the program generate the list at on click

                    Comment

                    • Dermot
                      Indigo Rose Customer
                      • Apr 2004
                      • 1790

                      #11
                      What Longedge gave does exactly what you want. Just put this at the end and you will see the result.
                      Code:
                      Dialog.Message("Result", text)
                      It all happens with one click.
                      Dermot

                      I am so out of here :yes

                      Comment

                      • presidente
                        Forum Member
                        • Jun 2008
                        • 110

                        #12
                        @ Unknown 2010

                        .apz are packed am7 aplications with all folders.
                        You can open it with a double-klick and AutoplayMediaStudio askes where you want to extract it.
                        After extracting the am7 file will automaticly be opened.

                        Comment

                        Working...
                        X