Let's say this is a pick 5 type lottery.The program creates combinations of 5 numbers.And let's say the maximum number is 80 and so let's say the user wanted the program to create all the combinations of 76 numbers.

Now the program writes to memory or a file every combnation it creates to check if the new combination was taken before. According to my calculations,the total number of combinations are 1311713640.

Multiply this number with 5 because there are 5 numbers in each combination,it is 6558568200 and multiply this with 4 because 1 int is 4 bytes(in 32 bit systems I think),this is 26234272800. So I think if the program writes combinations to a file,it wil reach 26.234.272.800 byte = a bit more than 26 gb 234mb.

So it would be a very big file,this is one of my problems.The other one is,checking the combinations and if one of them matches an earlier taken one then creating a new combination will be very long process in time.Because as the number of possible new combinations decrease, creating a new random combination which wasn't taken before will be much more difficult,will take much more time,may even seems like there is an infinite loop and the program halted.

I saw on internet a good method , program creates combinations from random numbers.For example,the random number is 51,and the program creates a 5 number combination from this number.In this way, you have to write to memory or a file just one number for each combination,so now ,according to my calculations, to find every possible combination of 76 numbers, you need to write 5.246.854.560 bytes = 5 gb 246 mb.

It's still a big file although it is much less than writing 5 numbers for each combinations to a file.But also,the problem of "as the number of possible new combinations decrease, creating a new random combination which wasn't taken before will be much more difficult,will take much more time,may even seems like there is an infinite loop and the program halted." still continues.Also,let's say there will be a power ball,I mean 5+1,and let's say maximum powerball number is 40,then you have to multiply 5.246.854.560 bytes which will be written to file,with 40.

For solving the "as the number of possible new combinations decrease ..." problem,I thought about making a list of numbers in a file,this list will start from 1 and last with the number of all possible combinations.There will be a maximumnumber variable,it's first value is the number of all possible combinations. Using the technique of creating a combination from a random number, when the program creates a random number, I use fseek and it will go forward in the file like

Quote:

fseek ( randomnumber*sizeof(int),SEEK_SET);

Quote:

fseek(maximumnumber*sizeof(int),SEEK_SET)

Then program will create a random number from the value of rnumber variable.This solves the speed problem maybe but can't solve creating a very big size of file problem.

So I couldn't find a good solution ]]>

I've mainly be working around the file format, headers, compression, interlacing and what have you. Well as I hack around this, I just generate some random image data which may not be very appealing :p

Now, coming to the question, are there some patterns I could use/implement code for to produce some at least "appealing" images ;) ]]>

How have people been debugging a curses app under python? searching around the web for this issue has been one of the most frustrating experiences I have had for a long while. gdb, really?? ]]>

unix flavour

Code:

`ps -C syslogd -o pid`

Does anyone know an alternative apart from greping? ]]>

(I realize that contrasting will not be possible for very large n, but it should look good for ..say.. n <=20)

I can not find a way to define what contrasting means w.r.t to the hex codes.

The obvious way does not look good at all.

By obvious way, I mean divide the total number of possible colors (assuming 32 bits for R/G/B) by N and assign colors in a linear loop.

What am I missing ? ]]>

I know that actually is not a C coding thread but i didn't know where to post it.

I found this interesting article on the net followed by a video showing a method for pixel coding. Maybe some of you already know this technique.

Here is the link.

How this guy choose the pallet color to use ?

Which logic connects the colors with the executable code ?

I did it with random colors and didn't work for example. ]]>