Well, let's say you have 100 16-bit opcodes each composed of...16 bits...duh.
It would be possible to come up with every permutation and thus you would also come up with correct opcodes. However, you would have to run through this algo for each line of code for as many lines as you want the program to be.
This would take an awful long time to generate but eventually yes you would come out with a fully functional assembly program given that your random number generator did not follow any type of pattern. If it did, then the repetition would throw the whole thing off and you'd never get a program. As well you would have no way of knowing when to stop the algo when a certain opcode was hit - for instance you could end up with
mov ax,bx
inc dx
lds esi,[32bitfullpointer]
ret
Now this is a program and the opcodes are correct but the code is not correct. This would crash hard and do nothing, but it is a valid program. See...you would need more rules to go by when selecting random opcodes.
The very thought of this makes my head spin.
It is the same with bitmaps. Theoretically a bitmap is just a collection of pixels. Given a 20x20 bitmap and 256 colors, if you randomized it enough you could come up with every picture one could ever create with 256 colors. But its not that simple and if you try it...even on the 1 millionth iteration you will probably only end up with colored snow - with no meaning to the pic at all. But a human could take these 256 colors and create a picture out of it in no time - the computer could never do this simply by random chance.
Code:
int main(void)
{
double iteration=1.0;
int loopcondition=1;
unsigned int offset=0;
unsigned char far *Screen=(unsigned char far *)MK_FP
(0xA000,0);
do
{
offset=0;
for (int i=0;i<20;i++)
{
offset=i*320+j;
for (int j=0;j<20;i++)
{
Bitmap[i][j]=SomeCompletelyRandomFunc(256);
Screen[j*320+i]=Bitmap[i][j];
offset++;
}
}
getch();
asm {
push di
les di,[Screen]
mov al,0
mov ah,0
mov cx,32000d
rep stosw
pop di
}
iteration+=1.0;
} while (loopcondition==1);
return (0);
}
You could run this a million times and never come up with a meaningful picture.
Better yet take a known picture and its 256 color palette and randomly pick which pixel of the bitmap to plot. The possible combos with having a known palette are 256*256*256* - 400 times. This is because in each of the 400 bitmap pixels or texels we can choose from 256 colors and since the colors can be repeated it would be 256*256*256* - 400 times.
This would be like playing a lottery that had 256 balls and 400 digit positions. Would take forever.
Most lotteries are 7 numbers ranging from 0 to 44 or something like that, thus 44*44*44*44*44*44*44.