Randomly distribute ones in a n bit vector

In reply to dave_59:

Unfortunately this solution seems not to work on the Cadence Incisive Simulator (tried on version 12.20.009 and 13.10.003). It seems that the simulator get stuck in an infinite loop.