Humans have a strong “cognitive compulsion” to infer intentional agents from violation of randomness and such an agency–nonrandomness link emerges early in development. In two studies, we directly quantified, formalized, and compared both ends of this link for the first time. In Experiment 1, two groups of participants viewed the same 256 binary sequences and classified each as generated by agents/non-agents or by nonrandom/random processes. We found a strong correlation between two judgments: sequences viewed as more agentive also tended to be judged as less ran- dom. In Experiment 2, another two groups were asked to produce sequences that others might appreciate as agentive or nonrandom. Participant-generated sequences in the two conditions had a substantial overlap, indicating common guiding principles of agency and nonrandomness generation. Taken together, the present studies provide evidence for a shared cognitive basis of agency detection and subjective randomness.