random c-block generator implementation