GitHub 6521★

Generate a random sign

JavaScript version

const randomSign = () => (Math.random() >= 0.5 ? 1 : -1);

TypeScript version

const randomSign = (): number => (Math.random() >= 0.5 ? 1 : -1);
Follow me on and to get more useful contents.