Thread: help..random pattern Ascii

  1. #1
    equlizer
    Guest

    help..random pattern Ascii

    Hi..
    I am pretty new to this...

    I am trying to make a small program that
    draws a nice pattern from the Ascii table.

    I want it to take char from Asci 179-190.. at random.

    And draw a nice little pattern over the screen.

    Any tips on how to use randomize ()

    So i can get started with this...

    Thanks....

    equlizer

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    32
    Sure, look up "srand" to 'seed' the random number generator first...so you actually may get randomness. Secondly after seeding the random number generator, you'll be using "rand" to get your random numbers.

    Now look at your number range. You want to start at 179 and end at 190. So start your number at 179, and add a random number using rand modulated by 12 (result would be 0 - 11).

    You'd end up with a value of 179 - 190.

    Next step when outputting your number would to cast it as type char so that the ASCII character of number x is outputted to the screen.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  2. Replies: 11
    Last Post: 03-24-2006, 11:26 AM
  3. Another brain block... Random Numbers
    By DanFraser in forum C# Programming
    Replies: 2
    Last Post: 01-23-2005, 05:51 PM
  4. Encoding with random ASCII
    By stevenC in forum C Programming
    Replies: 10
    Last Post: 10-27-2002, 04:02 PM
  5. Best way to generate a random double?
    By The V. in forum C Programming
    Replies: 3
    Last Post: 10-16-2001, 04:11 PM