web3

let singer = await web3.eth.accounts.create();

ethers

const pKey = new ethers.Wallet.createRandom();
const signer = new ethers.Wallet(pKey, ethers.provider);