const myVariable = Math.max(0, Math.min(1, Math.random() * 12345678)); // clamps the external value between 0 and 1.