Maybe you can use:
```java
int random = Math.random();
int points = task.getMaxPoints();

if(random > 0.8) return points;
if(random < 0.2) return 0;
return (int) points * random;
````

I think it's more readable.