This is not the solution, but it's a start on a concept:
(setvar 'dimzin (boole 2 (getvar 'dimzin) 8)); keep trailing zeros [for random integer]
(setvar 'hpname "SOLID")
(setq
pct (getint "\nPercentage to be hatched in color 1: ")
ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
(repeat (setq n (sslength ss))
(setq
rn (atoi (substr (rtos (rem (getvar 'cdate) 1) 2 16) (- 16 (rem n 3)) 2))
;; "random" integer from 0 to 99
); setq
(command
"_.hatch" "" (ssname ss (setq n (1- n))) ""
"_.chprop" "_last" "" "_color" (if (< rn pct) 1 2) ""
); command
); repeat
Because you will apparently need some randomness in distribution of the colors, it generates a "random" integer from 0 to 99 with each Polyline it Hatches, and if that comes out below the percentage called for, it makes the Hatch in that one color 1, or if above, color 2. [Use your own colors, or it could put them on different Layers instead, or use different patterns, or some other possibilities.] But that just "weights" the color distribution in the general direction of that percentage breakdown, which should [on average] get sort of close to the ratio asked for, expecially with large numbers of them, but it's still possible that in a given run, too many of them -- even all of them in theory -- could turn out the same color, because each is dealt with independent of the results on others so far.
[There are other random-number-generating approaches out there, some of which may give more truly random results than this one, but the same issue would apply.]
The next step, I think, is to figure out a way to weight the color given to each one based on the trend, i.e. keep track of how many have been made color 1, calculate the percentage of the total number of Polylines, or maybe the total number dealt with so far, and adjust one of the numbers being compared accordingly, so that as it approaches the end, it gets more and more likely to give things the color that hasn't been used often enough yet. I'll have to consider how that might be done. I think that once that's worked out, the same approach could be adjusted easily to work with more than just 2 colors, if you ever need that.
But bear in mind that even with that worked out, and if you get exactly the percentage distribution you want in quantity of each color, you could still get a pattern of distribution that you don't like. An example: my wife made a quilt for one of our sons and his bride as a wedding present, using a large number of different fabrics in what she wanted to be a random distribution. Our other son, the mathematician, came up with a randomization algorithm, but it resulted in various areas where too many pieces of the same or too-similar fabric ended up too close to each other, and they had to "fix" it to look better. You don't, in reality, want "true" randomness in something with a non-quantifiable visual requirement. I can't imagine a way to avoid that kind of problem with an AutoLisp routine, so however that develops, you're probably still going to need to look it over and "fix" things afterwards, at least sometimes.
Kent Cooper, AIA