Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Programming (https://www.askmehelpdesk.com/forumdisplay.php?f=437)
-   -   Action scripting (https://www.askmehelpdesk.com/showthread.php?t=276685)

  • Nov 3, 2008, 12:04 PM
    tarun khurana
    action scripting
    hello sir! I want to ask that question about random numbers.I know how to generate random nos but I don't know how to save that number example:
    like that I show u below:
    :confused:// command: trace(Math.floor(Math.random()*10));
    some no. appears on the screen like 4
    I want to save that no above so that I can use it further,again I traced the command
    some no appears like 6 I want that the previous no and the current no adds,subtract etc.
    like 4+6=10;
    how to do so?
    what scripting I use there?
    help me!
    I'm very thankful to u if I get the answer:)
  • Dec 15, 2008, 08:29 AM
    cheeseycheese
    Quote:

    Originally Posted by tarun khurana View Post
    hello sir! i want to ask that question about random numbers.i know how to generate random nos but i dont know how to save that number example:
    like that i show u below:
    :confused:// command: trace(Math.floor(Math.random()*10));
    some no. appears on the screen like 4
    i want to save that no above so that i can use it further,again i traced the command
    some no appears like 6 i want that the previous no and the current no adds,subtract etc.
    like 4+6=10;
    how to do so?
    what scripting i use there?
    help me!
    i m very thankful to u if i get the answer:)

    your kidding rite? I mean yes that's how you make a random number, but usually people learn the basics of programming before looking into functions in specific languages.

    Anyway, you would simply store it in a variable
    e.g..

    var1 = Math.floor(Math.random()*10);
    trace(var1)l
    //then to do a calculation of it

    trace(var1+5);

  • All times are GMT -7. The time now is 09:41 PM.