backend-src/phrases.js
/**
 * Returns the phrases for a given phrase id in a random order.
 * @param {Number} id
 */
Returns the phrases for a given phrase id in a random order.
@param {Number} id
Returns the phrases for a given phrase id in a random order . @param { Number } id
function randomOrderPhrases(id) {
    const ptc = phrases[id].slice(1);
    const tr = [phrases[id][0], ptc.splice(Math.floor(Math.random() * ptc.length), 1)[0]];
    tr.push(ptc.splice(Math.floor(Math.random() * ptc.length), 1)[0]);
    return tr.sort(() => Math.random() - 0.5);
}
function randomOrderPhrases ( id ) { const ptc = phrases [ id ] . slice ( 1 ) ; const tr = [ phrases [ id ] [ 0 ] , ptc . splice ( Math . floor ( Math . random ( ) * ptc . length ) , 1 ) [ 0 ] ] ; tr . push ( ptc . splice ( Math . floor ( Math . random ( ) * ptc . length ) , 1 ) [ 0 ] ) ; return tr . sort ( ( ) => Math . random ( ) - 0.5 ) ; }
Returns the phrases for a given phrase id in a random order.
Returns the phrases for a given phrase id in a random order .