0 Members and 1 Guest are viewing this topic.

void newrow(uint16_t row){ srand(time(NULL)); chance[0]=1000/(abs(pow(row-10,1.1))+50);//1000/(abs(pow(row-row_where_it_is_most_common,range_of_how_common_it_is))+100/percent_of_blocks_in_most_common_row) //coal is found with a frequency of 100/50=2% of blocks in the row in which it is most commonly found //coal is most commonly found in row 10 (actually 11 in the array, but 1 more or less doesn't make a huge difference) //coal is commonly found in a large range of blocks, note the low exponent //note that 0 in this array corresponds to 2 in blocktype chance[1]=1000/(abs(pow(row-30,1.1))+60);//iron is found in 1.667% or 16/1000 blocks in the generator at max, and is also very common chance[2]=1000/(abs(pow(row-50,1.1))+80); chance[3]=1000/(abs(pow(row-80,1.1))+20); chance[4]=1000/(abs(pow(row-110,1.3))+100); chance[5]=1000/(abs(pow(row-150,1.5))+150); for(int i=0;i<40;i++) { tempint=((SDL_GetTicks()+rand()+i)^(row*i))%1000; sleep(1); for(int z=0;z<6;z++) { if(z==5) { if(rand()%8) { map[row][i]=dirt; break; } map[row][i]=nothing; break; } if(chance[z]>tempint) { map[row][i]=(static_cast<blocktype>(z+2)); break; } tempint-=chance[z]; } }}

Shouldn't your language have pseudo-random built-in?

you only set the seed once all at the beginning of your program.

Quote from: Sorunome on June 17, 2014, 05:26:52 pmyou only set the seed once all at the beginning of your program.WoopsEpic failLooks like I still have much to learn

I was about to say that too.Otherwise, you can try integrating a library such as this one: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

Since this looks a lot like Drillminer (basically motherload with MC block skins), you could ask epic7 for the source so you can get some help with this issue, and engine stuffs.

Looks nice so far by the way