Long[] owners = { 1L, 2L, 3L, 4L, 5L };
BlockType[] blockTypes = { BlockType.ASSIGNED, BlockType.FREE };
for (int i = 0; i < count; ++i) {
Long ownerId = IpBlockEntity.FREE_BLOCK_OWNER_ID;
BlockType blockType = blockTypes[(int) (Math.random() * blockTypes.length)
% blockTypes.length];
if (blockType != BlockType.FREE) {
ownerId = owners[(int) (Math.random() * owners.length) % owners.length];
}