Skip to content

Instantly share code, notes, and snippets.

@csokol
Created September 19, 2018 12:08
Show Gist options
  • Save csokol/ace67552a79645ba6002523c3c11fd17 to your computer and use it in GitHub Desktop.
Save csokol/ace67552a79645ba6002523c3c11fd17 to your computer and use it in GitHub Desktop.
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Random;
import java.util.stream.IntStream;
public class Foo {
public static void main(String[] args) throws FileNotFoundException {
IntStream range = IntStream.range(1, 100_000);
PrintWriter datafile = new PrintWriter("datafile");
range.map(i -> new Random(i).nextInt(100))
.forEach(datafile::println);
datafile.close();
}
}
set term png
set output "hist.png"
binwidth=1
bin(x,width)=width*floor(x/width)
plot 'datafile' using (bin($1,binwidth)):(1.0) smooth freq with boxes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment