Closed Thread
Results 1 to 4 of 4

Thread: Random Map Generation

  1. #1
    chax's Avatar
    chax is offline Learning Programmer
    Join Date
    Oct 2006
    Location
    India
    Posts
    69
    Rep Power
    20

    Random Map Generation

    I am working on a program (trying to code up) which produces Random maps using the diamond-square algorithm. But what I found was that even after using rand() function I am getting maps that are identical.

    Here is my code:
    Attached Files Attached Files

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0
    I am just sort of guessing here since I did not take much time to look at the code and understand what it's doing.

    When you call rand() without any argument it uses the number 1, so essentially you are getting a return value of 0.nnnnnnnnn each time you use rand. Try replacing each instances of rand() with something like "int rand(500)" or whatever value is appropriate instead of 500.

  4. #3
    Devant is offline Newbie
    Join Date
    Sep 2007
    Posts
    1
    Rep Power
    0
    Hi there! I am working on a very similar project, trying to create random maps using visual basic (I do it with a very slow and inneficient proccess using drawn pixels one by one). I would like to discuss with you, feel free to drop an email (I am not a regular user of CodeCall)

    devant86 at hotmail dot com

  5. #4
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0
    If that was directed at me, I don't do emails or visual basic.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Program for Image Processing & Random Sentence Generation
    By chax in forum General Programming
    Replies: 5
    Last Post: 10-08-2011, 01:30 PM
  2. Using a random function to generate another random funtion
    By Roger in forum General Programming
    Replies: 11
    Last Post: 08-23-2010, 08:07 AM
  3. PHP Image Generation
    By Bioshox in forum PHP Development
    Replies: 2
    Last Post: 05-19-2010, 10:45 PM
  4. Random generation of string, towards goal result
    By Bishop in forum General Programming
    Replies: 4
    Last Post: 03-04-2010, 02:38 AM
  5. Random password generation
    By Divya in forum PHP Development
    Replies: 7
    Last Post: 07-03-2009, 04:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

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