The big primes in RSA algorithm should be of same length, and co-prime. You can write a code which generates primes from 2,3,5,7.... until the bits you specified.
For example, you want to generate a prime which is of length 15 bits, just generate a prime which is larger than 2^15.
the pseudocode will be as followed:
int prime[MAX_INT],flag;
prime[0] = 2;
prime[1] = 3;
prime[2] = 5;
count = 3;
i = 7;
while ( i < 2^b) {
flag = 0;
for (j = 0, j<count; j++) {
if (i is not divided by j) flag = 1;
else {flag = 0;break;}
};
if (flag==1) {prime[count]=i;count++};
i++;
}
sorry for not being able to type Chinese, any questions, do not hesitate to ask me.