Preview:
MyRandom.java:


public interface MyRandom {
    double generate();
}


MyRandomDemo.java:


public class MyRandomDemo {
    public static void main(String[] args) {
        MyRandom random = () -> Math.random();

        System.out.println("Random number: " + random.generate());
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter