Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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