How to divide online survey respondents into 5 equal groups

Discussion in 'Mac Programming' started by wordmunger, Nov 10, 2006.

  1. wordmunger macrumors 603

    wordmunger

    Joined:
    Sep 3, 2003
    Location:
    North Carolina
    #1
    Quick question for those more computer-savvy than I am. Can you help me divide readers into five roughly equal groups (it's for this week's Casual Friday on Cognitive Daily) within Survey Monkey, an online survey site.

    In the past, I've relied on the "what month is your birthday in" question, but it won't work when I need five groups.

    Surely there's a simple javascript out there that would automatically return a random number from 1 to 5. Then I can just ask people what number they see, and then direct respondents to the correct survey based on the number.

    I've done a few searches, but most of the scripts I could find have been too complicated, requiring user input. I just want the number to be automatically generated according to my specifications.

    Thanks in advance for your help!
     
  2. wordmunger thread starter macrumors 603

    wordmunger

    Joined:
    Sep 3, 2003
    Location:
    North Carolina
    #2
    Just as an FYI, a cogdaily reader showed me how to do it:

    Code:
    <p>
    Presenting a number between 1 and 5:
    <script language="javascript">
    function random( numGroups )
    {
    var num = Math.round( numGroups * Math.random() );
    
    return num == 0 ? numGroups : num;
    }
    
    document.write( random( 5 ) );
    </script>
    </p>
     
  3. iSee macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #3
    Why not pick a random survey automatically? That way, the user doesn't have to enter anything.

    Or is it to prevent 'bots from getting to your survey, or something like that?
     
  4. wordmunger thread starter macrumors 603

    wordmunger

    Joined:
    Sep 3, 2003
    Location:
    North Carolina
    #4
    Because I want their survey results to appear together in the same survey, and survey monkey doesn't support that sort of automation from within. I could randomize it automatically on entering the survey, but then I'd have to analyze five different results files.

    For example, two weeks ago we did a survey which divided participants into four groups; some of them saw one version of a movie, and others saw a different version. Then all respondents were asked the same questions about the movie.

    If you'd like to try the new survey, complete with randomization script, here's the link:

    PowerPoint survey

    The survey is designed to determine whether we learn better from PowerPoint (actually Keynote!) or plain text.
     

Share This Page