Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-2007, 08:49 AM
Anirban Chakraborty's Avatar   
Anirban Chakraborty Anirban Chakraborty is offline
Learning Programmer
 
Join Date: Oct 2006
Location: India
Posts: 44
Credits: 20
Rep Power: 8
Anirban Chakraborty will become famous soon enough
Default 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
File Type: txt Randommapgenerator.txt (3.5 KB, 11 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-01-2007, 03:04 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-02-2007, 01:32 PM
Devant Devant is offline
Newbie
 
Join Date: Sep 2007
Posts: 1
Credits: 0
Rep Power: 0
Devant is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-03-2007, 08:58 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

If that was directed at me, I don't do emails or visual basic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating Random Numbers with PHP Paradine PHP Tutorials 4 08-27-2007 07:09 PM
Return random numbers without duplicates Paradine PHP Tutorials 0 08-26-2007 02:07 PM
How do I program a random generator? eddiewillers General Programming 4 07-24-2007 02:26 PM
Code:PHP Random Functions John PHP Tutorials 2 12-03-2006 10:04 AM
I need to generate a random number in PHP dirkfirst PHP Forum 7 07-05-2006 09:58 PM


All times are GMT -5. The time now is 04:52 AM.

Contest Stats

Xav ........ 1024.41
MeTh0Dz|Reb0rn ........ 974.08
morefood2001 ........ 850.04
John ........ 841.93
WingedPanther ........ 661.52
marwex89 ........ 575.59
Brandon W ........ 456.18
chili5 ........ 292.12
orjan ........ 187.41
Steve.L ........ 181.88

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 79%

Ads