Re: shuffling (randomizing) a series
- To: mathgroup at smc.vnet.net
- Subject: [mg52914] Re: [mg52857] shuffling (randomizing) a series
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Thu, 16 Dec 2004 03:41:52 -0500 (EST)
- References: <200412150926.EAA10600@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I suggest you use RandomPermutation in the AddOn DiscreteMath`Combinatorica`. In[1]:= <<DiscreteMath`Combinatorica` Here you have a list of 1,000,000 integers: In[2]:= lstA = Table[Random[Integer, {1, 100}], {1000000}]; This will produce a random shuffling of the list in less than 5 seconds: In[3]:= AbsoluteTiming[lstA[[RandomPermutation[ Length[lstA]]]]; ] Out[3]= {4.9687500 Second,Null} Tomas Garza Mexico City ----- Original Message ----- From: "George Szpiro" <george at netvision.net.il> To: mathgroup at smc.vnet.net Subject: [mg52914] [mg52857] shuffling (randomizing) a series > Hello, > > I would like to put a series of numbers (of the order of 10^7 numbers) > into > random order, i.e., to shuffle it. In Excel I would simply add a column > next > to the column with the data, and then sort by the random number. But I > could > only do this for 64000 numbers. How can I do that in Mathematica for a > file with a > much larger series? > > (could you please copy any answer to my address: > george at netvision.net.il) > > Thanks! > George > > > -- > > -------- > George Szpiro > Neue Zürcher Zeitung (Switzerland) > POB 6278 > Jerusalem 91060 > Israel > > > > >
- References:
- shuffling (randomizing) a series
- From: George Szpiro <george@netvision.net.il>
- shuffling (randomizing) a series