MediaSFU Angular
    Preparing search index...

    Class GenerateRandomPolls

    Generates an array of random poll objects with varying types and options.

    Each poll includes a question, a type (e.g., "trueFalse", "yesNo", or "custom"), and multiple choice options. Poll types determine the options generated:

    • "trueFalse" polls have "True" and "False" options.
    • "yesNo" polls have "Yes" and "No" options.
    • "custom" polls generate 2–6 custom options labeled as "Option 1", "Option 2", etc.

    An object containing the number of polls to generate.

    The number of random polls to generate.

    An array of generated polls with unique IDs and randomly selected types and options.

    const pollService = new GenerateRandomPolls();
    const options = { numberOfPolls: 3 };
    const randomPolls = pollService.generateRandomPolls(options);

    console.log(randomPolls);
    // Output:
    // [
    // { id: '1', question: 'Random Question 1', type: 'yesNo', options: ['Yes', 'No'], votes: [0, 0], status: 'inactive', voters: {} },
    // { id: '2', question: 'Random Question 2', type: 'trueFalse', options: ['True', 'False'], votes: [0, 0], status: 'inactive', voters: {} },
    // { id: '3', question: 'Random Question 3', type: 'custom', options: ['Option 1', 'Option 2', 'Option 3'], votes: [0, 0, 0], status: 'inactive', voters: {} }
    // ]
    Index

    Constructors

    Methods

    Constructors

    Methods