James's random coding