Use the real opacities instead of Math.random()
Fix some bugs in opacity display

- Avoid division by zero when calculating opacity
- The counter in results should incrementally increase