Shuffle

Question: Define a function 'shuffle' that randomly reorders the items of the given list or table.

Example

                                
                                q)shuffle `a`b`c`d`e`f`g
`b`e`d`a`g`c`f
q)show t:([]s:`AAPL`MSFT`IBM`TSLA;p:100 200 300 400)
s    p
--------
AAPL 100
MSFT 200
IBM  300
TSLA 400
q)shuffle t
s    p
--------
AAPL 100
TSLA 400
IBM  300
MSFT 200
                                
                            

Solution

Tags:
functions
Searchable Tags
algorithms api architecture asynchronous c csv data structures dictionaries disk feedhandler finance functions ingestion ipc iterators machine learning math multithreading optimizations realtime shared library sql statistics streaming strings tables temporal utility websockets