Results 1 to 9 of 9

Thread: So I have this list of 40 questions I want in a unique order 351 times

  1. #1
    Join Date
    Aug 2013
    Beans
    14

    So I have this list of 40 questions I want in a unique order 351 times

    So I have this list of 40 questions I want in a unique order 351 times

    The list of questions is in a text file but I am willing to copy and paste them into whatever format is needed.

    I need 351 unique sets of the same questions witch each set in a different order. What can I do on ubtunu to hit my needs?

    Mike

  2. #2
    Join Date
    Apr 2008
    Location
    Southern California, USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: So I have this list of 40 questions I want in a unique order 351 times

    [I give up or don't understand the question]
    Last edited by VMC; August 16th, 2013 at 06:09 PM.
    AMD64 Athlon X2 Dual-Core - nVidia Geforce 6150 SE - 4GB DDR3 | remove_old_kernels

  3. #3
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    9,374
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Searching the web: http://en.wikipedia.org/wiki/Permutations

    You want a reduced set of permutations (40 questions taken 40 at a time, order is important AND no repetition of questions). The following link is a calculator and list creator: http://www.mathsisfun.com/combinator...alculator.html with some explanation: http://www.mathsisfun.com/combinator...mutations.html

    In linux, two commands are helpful apropos and apt-cache search:

    tgalati4@Mint14-Extensa ~ $ apropos permutation
    shuf (1) - generate random permutations
    tgalati4@Mint14-Extensa ~ $ apt-cache search permutation
    libbtf1.1.0 - permutation to block triangular form library for sparse matrices
    libsuitesparse-dbg - libraries for sparse matrices computations (debugging symbols)
    libsuitesparse-dev - libraries for sparse matrices computations (development files)
    libsuitesparse-metis-3.1.0 - collection of libraries for computations for sparse matrices
    libsuitesparse-metis-dbg - collection of libraries for computations for sparse matrices
    libsuitesparse-metis-dev - collection of libraries for computations for sparse matrices
    libalgorithm-permute-perl - module to perform permutations with object oriented interface
    libghc-hcard-dev - library for implementing a Deck of Cards
    libghc-hcard-doc - library for implementing a Deck of Cards; documentation
    libghc-hcard-prof - library for implementing a Deck of Cards; profiling libraries
    libitsol-dev - ITerative SOLvers - devel
    libitsol1 - ITerative SOLvers - runtime
    libmath-combinatorics-perl - module for performing combinations and permutations on lists
    libstring-glob-permute-perl - Expand {foo,bar,baz}[2-4] style string globs
    libxml-semanticdiff-perl - Perl extension for comparing XML documents
    python-pytools - big bag of things supplementing Python standard library
    python3-pytools - big bag of things supplementing Python 3 standard library
    r-cran-gregmisc - GNU R package with miscellaneous functions by Greg Warnes et al
    r-cran-permute - R functions for generating restricted permutations of data
    unsort - reorders lines in a file in semirandom ways

    apropos will search your system for any commands that have a keyword, in this case permutation. apt-cache search will search the repositories for any packages that might perform permutations.

    You can write a script to take your list of 40 lines and jumble it 351 times to create your new lists.

    From apropos, there is a command call shuf (presumably from shuffle) that gets you closer:

    Open a terminal:

    Code:
    man shuf
    You can also install unsort and see what it offers.

    There are probably 10 ways to do this, but you want to find the most elegant way.

    Create a text file with your 40 questions and start playing with it:

    tgalati4@Mint14-Extensa ~ $ cat shuffle_test.txt
    This is line number 1.
    This is line number 2.
    This is line number 3.
    This is line number 4.
    This is line number 5.
    This is line number 6.
    This is line number 7.
    This is line number 8.
    This is line number 9.
    This is line number 10.
    tgalati4@Mint14-Extensa ~ $ shuf shuffle_test.txt
    This is line number 5.
    This is line number 9.
    This is line number 1.
    This is line number 7.
    This is line number 4.
    This is line number 2.
    This is line number 3.
    This is line number 6.
    This is line number 10.
    This is line number 8.

    Now write a script to check for duplicates and save to unique file names.
    Last edited by tgalati4; August 16th, 2013 at 05:20 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  4. #4
    Join Date
    Jul 2013
    Beans
    190

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Do you know something about statistic and programming?

  5. #5
    Join Date
    Sep 2006
    Location
    France.
    Beans
    Hidden!
    Distro
    Ubuntu Mate Development Release

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Quote Originally Posted by VMC View Post
    Is this a class assignment?
    Is it ? bostoncab2 please answer the question, thanks.
    | My old and mostly abandoned blog |
    Linux user #413984 ; Ubuntu user #178
    J'aime les fraises.
    Nighty night me lovelies!

    | Reinstalling Ubuntu ? Please check this bug first ! |
    | Using a ppa ? Please install ppa-purge from universe, you may need it should you want to revert packages back |
    | No support requests / username changes by PM, thanks. |

  6. #6
    Join Date
    Oct 2010
    Location
    Above ground...(for now)
    Beans
    761

    Re: So I have this homework assignment I want someone else to do for me.

    Here you go, Mike.
    Run this:
    Code:
    #!/bin/bash
    set -e
    
    echo -e "\nStep 1: Get a deck of playing cards." \
      "\nStep 2: Remove the jokers and the face cards." \
      "\nStep 3: Use gedit in Ubuntu to create a text file where you manually map each of the remaining forty cards to a unique question."
    for i in {4..1056..3}; do
      echo "Step $i: Manually shuffle the cards."
      echo -e "Step $(( i + 1 )): Create a new text file using gedit in which you arrange the questions according to the order of your shuffled cards" \
      "\n           and the mapping you made in Step 3."
      echo "Step $(( i + 2 )): Print the file on a piece of paper."
    done
    echo -e "Step 1057: Stack all your printed papers and bind the stack with a couple of rubber bands." \
      "\nStep 1058: Turn the stack in to your teacher." \
      "\nStep 1059: Don't worry about any duplicates in your stack." \
      "\n           There's hardly any chance that your teacher is going to check them.\n"
    
    exit 0
    Don't work too hard, Mike.

    Crusty
    Last edited by Crusty Old Fart; August 17th, 2013 at 10:50 AM.
    Suffering from severe chronic female supervision deficiency syndrome resulting in
    an increasing intolerance of adolescent scatological effluence and PMS induced nefarious diatribe.
    How to: Mark your thread as: [SOLVED]

  7. #7
    Join Date
    Oct 2010
    Location
    London
    Beans
    481
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Code:
    for f in {1..351}; do shuf --random-source=<(echo $f) input.txt > output${f}.txt; done
    The above assumes that you want each permutation in a different file; you will end up with 351 output files. Please note that I haven't tested this extensively.
    Last edited by evilsoup; August 17th, 2013 at 11:46 AM.
    Please mark your thread as solved if you get a satisfactory solution to your problem.

  8. #8
    Join Date
    Oct 2010
    Location
    Above ground...(for now)
    Beans
    761

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Quote Originally Posted by evilsoup View Post
    ...The above assumes that you want each permutation in a different file; you will end up with 351 output files...
    It also assumes it isn't homework, which is an assumption that is this close --><-- to impossible for me.
    Perhaps I'm getting increasingly crusty with age, or I'm suffering from chronic female supervision deficiency syndrome, or both.
    Last edited by Crusty Old Fart; August 17th, 2013 at 12:14 PM.
    Suffering from severe chronic female supervision deficiency syndrome resulting in
    an increasing intolerance of adolescent scatological effluence and PMS induced nefarious diatribe.
    How to: Mark your thread as: [SOLVED]

  9. #9
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 15.04 Vivid Vervet

    Re: So I have this list of 40 questions I want in a unique order 351 times

    Since answers are still being given despite the fact that the OP has not yet answered the question as to whether or not this is homework, I've closed the thread, at least for the time being.

    @bostoncab2, from the Posting Guidelines which form part of the forum rules:

    While we are happy to serve as a resource for hints and for asking questions when you get stuck and need a little help, the Ubuntu Forums is not a homework service. Please do not post your homework assignments expecting someone else to do it for you.
    If this is not homework, and you need more help, click on the button in your own post to send a request for re-opening to the staff area.
    Ubuntu 15.04 Desktop Guide - Ubuntu 14.04 Desktop Guide - Forum Guide to BBCode - IRC #ubuntuforums

    Member: Not Canonical Team

    Please do not PM me about your forum account unless you have been asked to. The correct place to contact an admin about your account is here.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •