I am attempting to perform a comparison of pseudorandom number generation with the RAND Corporation's "A Million Random Digits with 100,000 Normal Deviates" for a Computational Physics course.

I have the text file, which is available from the RAND Website. I have tried Import and Import["data.txt", Table] with minimal success. My desire is to get this in a table format where I can then use them in a Monte Carlo simulation. I would prefer to be able to address this in the format "randData[m,n]" like addressing the value in an m,n matrix.

I am aware of similar questions, and have used the search. Thanks in advance for your assistance.

importing a matrix Importing data sets from plain-text files and performing operations on them


1 Answer 1

import = Import["c:\\users\\rasher\\downloads\\digits.txt"];
randData = Partition[ToExpression[StringSplit[import]], 11];

randData[[1, 10]]

( * 39292 *)

randData is [[line, column]] of the text, in numeric form.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.