JSFiddle - React, Tailwind, and code Playground
HTML
<input id="input">
<button id="go">Go</button>
<p id="result"></p>
JavaScript
const id = (s) => document.getElementById(s);
const rand = (n) => Math.random() * (n + 1) | 0;
/***/
id("go").addEventListener("click", function() {
let n = +id("input").value;
let a = rand(n);
let b = rand(n - a);
let c = n - a - b;
id("result").textContent = [a, b, c].join(", ");
});