+ Reply to Thread
Results 1 to 5 of 5

Thread: Random numbers in assembly

  1. #1
    joe_1 Newbie
    Join Date
    Feb 2004
    Location
    Boston, USA
    Posts
    39

    Default Random numbers in assembly

    Hi:

    Does anyone know how to generate random numbers using assembly code?
    I know how to do it in Basic and C, and want to know how to do it in assembly.

    Thanks.


  2. #2
    Exo
    Exo is offline
    Exo Newbie
    Join Date
    Sep 2003
    Location
    Belgium
    Posts
    1,884

    Default

    What do you need it for ?

    if the project is driven by an external event (such as someone needs to push a button b4 something happens) then you can use that event to create a random number...
    Set up a timer at the start of your program (W/O prescaling) and leave it running, and capture the timer value when someone presses the button, should be pretty random...

    if it has to generate random numbers all by itself then i don't really have a clue ops: ... perhaps you should hack some of the code generated by the basic compiler to see how it works

  3. #3
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,778

    Default Re: Random numbers in assembly

    Quote Originally Posted by joe_1
    Hi:

    Does anyone know how to generate random numbers using assembly code?
    I know how to do it in Basic and C, and want to know how to do it in assembly.

    Thanks.
    Try here, it works fine http://www.dontronics.com/psbpix/random.html 8)
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  4. #4
    joe_1 Newbie
    Join Date
    Feb 2004
    Location
    Boston, USA
    Posts
    39

    Default

    Thankx folks.

  5. #5
    crust Okay
    Join Date
    Sep 2003
    Posts
    728

    Default

    There are various random number algorithms such as the monte-carlo, etc. You can also capture circuit noise and have it trigger something in your software to generate random numbers. Easier said than done, but it does work.

+ Reply to Thread

Tags for this Thread