random number gen
Results 1 to 5 of 5

Thread: random number gen

  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    69

    random number gen

    I, im making an alarm clock kind of thing for my computer, i want to run one of so many songs etc, but I cant find a command line number generator (we are talking about windows) ive tried the %RANDOM% but thats to many numbers, id rather just something simple then using a whole bunch of unneeded code. The program i need just needs to be able to output to a command console
    Signature image is too tall!

  2. #2
    Senior Member
    Join Date
    Jul 2003
    Posts
    813
    Since you're making the alarm clock why not embed the random number generator in it? Or maybe write a separate program just for that [we're probably talking about very simple 'randomness' but that should be good enough] and you could maybe use it later for something else too.
    /\\

  3. #3
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    Actually, I agree with hypronix, however, we do not know whether the thread
    starter creates his alarm clock based on a batch file.

    So, here ya go:
    Code:
    @echo off
    (set /A play_nr=%random% %% %1) 
    echo %play_nr%  1>play_nr.txt
    type play_nr.txt

    1. create a batch file, name it "my_random.bat"
    2. start it with "my_random.bat 100", if you have 100 songs
    3. this will generate random numbers between 0 and 99
    4. "set" can be used to perform calculations. "%%" is replaced
    by "%" which is the modulo-operator. %random%[1]





    Cheers

    /edit: reference added as per request

    [1] http://www.microsoft.com/resources/d...loverview.mspx
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  4. #4
    Banned
    Join Date
    Jul 2005
    Posts
    511
    %RANDOM% ? Lol! Never knew that one. Am learning something new every day. Thanks. Now, question... Where is it documented? Or is this an undocumented feature of XP?

  5. #5
    Member
    Join Date
    Sep 2003
    Posts
    69
    Thanks mate, i saw a mod some place they had an alarm clock, it was one song tho, and it grabbed RSS feeds from places, converted them to just plain text removing the tags etc and used the TTS reader to read it out. Thanks again for ya help
    Signature image is too tall!

Posting Permissions

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