Shuffling is a pretty interesting operation in several scenarios. And different languages / platforms have interesting features using the shuffling operation.
Examples:
- Shuffle the contents of a C# List
- Select random lines from file (using ‘shuf’ command in Linux)
References:
- C#
- Linux
- http://unix.stackexchange.com/questions/108581/how-to-randomly-sample-a-subset-of-a-file
- shuf command:
- shuf -n 500000 ydata-fp-td-clicks-v1_0.20090501 -o 20090501/sample_500K
- split command
- Pandas:
- pandas has a ‘sample’ function that can be very useful to randomly sample rows from a pandas dataframe.
- http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.DataFrame.sample.html
Code: