On Mon, Apr 21, 2003 at 06:26:09PM +0900, Pit Capitain wrote: > Given a set of values Vi and their desired number of occurrences in > the final sequence Ni, it can be shown that there exists a sequence > as Hal described if and only if > > max( Ni ) <= ( sum( Ni ) + 1 ) / 2 > > If anybody is interested in the proof, I can try to translate it to > English and send it in another post. I see that max(Ni) > sum(Ni)/2 => p(Vi) > 0.5 => would have to repeat however I don't know why you have '+1' (unless you meant '<') :-? > Using this simple test you can implement the following algorithm > based on the weighted random algorithm shown in other posts: > [...] Really nice, seems you killed the problem! :) I like the name 'Hal's sequence' :-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com * LG loves czech girls. <vincent> LG: do they have additional interesting "features" other girls don't have? ;) -- #Debian