Minecraft wiki entry for Enchanting_mechanics, associated text: R1 and R2 are two individual randomly generated integers:
R1 = randomInt(0, E / 4)
R2 = randomInt(0, E / 4)
B is the base enchantment level.
E is the enchantability of the item.