Results 1 to 6 of 6

Thread: Random Data

  1. #1

    Random Data

    At any point in assembly code, is there any way to generate/get random numbers and/or letters ?

    I have limited space in an installation program that unpacks some files.
    During the unpacking I can find/replace a server check.
    Instead of replacing the server domain name with something static, I'd like to replace the domain with some random number&letters.

    Last edited by Maze; April 21st, 2009 at 17:21.

  2. #2
    Try mutilating GetTickCount()'s result, thats going to be pretty random unless of course you run the program at the exact same tick count after bootup every time

  3. #3
    Can I access it in memory ?
    RDTSC or reading 0x7ffe0004 ?

  4. #4
    Sure, RDTSC will work, or you can import GetTickCount from kernel32 dll. They give you different data, but since you don't care about it, RDTSC will be the easiest (as long as TSD in CR4 isn't set, I believe).

  5. #5
    IBM has a library called truerand which extracts entropy from the oscillations between the CPU and motherboard clock crystals and then runs it through an entropy purification algorithm to generate what is essentially truly random bits. I'm not sure how important the randomness is in whatever you're doing, but it doesn't get much more random than that.

  6. #6
    Registered User fuex's Avatar
    Join Date
    Oct 2006
    If you don't need highly random numbers (i.e, for cryptography), a simple "Linear congruential generator" may be suitable.
    You could just have a look at the source code of some rand() implementations in some libraries (like libc) and try to do exactly the same.

    For the seed, use GetTickCount.
    - extend your mind -

Similar Threads

  1. The Legend Of Random
    By wolfswar in forum The Newbie Forum
    Replies: 4
    Last Post: January 26th, 2014, 15:26
  2. Random Freezing
    By naides in forum Off Topic
    Replies: 2
    Last Post: December 6th, 2008, 04:48
  3. Help! Random reboot using SoftICE for WinXP!
    By Moddie in forum Tools of Our Trade (TOT) Messageboard
    Replies: 18
    Last Post: January 12th, 2004, 21:14
  4. Random Number Analysis
    By akimp3 in forum RCE Cryptographics
    Replies: 22
    Last Post: April 20th, 2002, 19:56


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts