abstracted a simple bar length generator.