As I say, it's a known problem with multiple known solutions. It's just that *I've* never done it.
It's fairly "untestable", so tomorrow, I'll start by writing some kotlin and rendering the histogram at T=0, just to make sure I have the S distribution looking like it should.