
Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
>I doubt those two rules are sufficient. You must also specify what
>you mean by "random".
I interpreted the question to mean, integers are to be selected with a
pseudorandom number generator with uniform distribution in the range 1
.. 100 without regard to primality. However, a solution with less than
10 primes is not acceptable as is a solution with any number repeated.
Obviously that is not how you rapidly compute a solution, but I think
that is one way of describing the solution.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Googmeister - 19 Dec 2005 23:48 GMT
> >I doubt those two rules are sufficient. You must also specify what
> >you mean by "random".
[quoted text clipped - 6 lines]
> Obviously that is not how you rapidly compute a solution, but I think
> that is one way of describing the solution.
Yes, barring any additional info, this seems to be the natural
way to interpret the question. For the specific problem mentioned,
this is likely fast enough. To speed things up, you could select
30 of the 100 integers (using the first 30 iterations of the
standard shuffling algorithm), check if you have >= 10 primes.
If not, repeat.
Here's a somewhat more efficient method if the problem
size increase. Break this problem into two pieces: (i) determine
exactly how many primes to include, then (ii) randomnly choose
the required number of primes and nonprimes as above. To do
part (i), repeatedly generate Binomial(30, p) random variable
until you get a number >= 10. Here p = fraction of primes in
desired range. This has the desired distribution, and it should
be reasonably efficient, even if the problem size increases.