##EDIT
Actually, the previous code I gave in 1/ to round numbers is not exactly rounding the numbers ... , it is just removing all the digits that are not "needed". For example myround[1.3458,3]
returns 1.345
instead of 1.346
!
Anyway, I just found out a much simpler solution :
###0/
Use for example
Round[number, 10^-3]
instead ofRound[number, 0.001]
to prevent from getting the "extraneous digits" that appear when you copy/paste.As before, use
InputForm
in order to suppress theNumberMarks
when you copy/paste
For example, concerning the extraneous digits, compare :
InputForm@N[Round[#, 10^-3] & /@ RandomReal[{1, 10}, 100]]
with
InputForm@N[Round[#, 0.001] & /@ RandomReal[{1, 10}, 100]]
======================================================================= ###PREVIOUS
Is this working for you ?
###1/ This code will produce exactly a real with at most n digits to the right of the decimal point :
myround[x_, n_] := IntegerPart[x] + IntegerPart[10^n*FractionalPart[x]]/10^n
then
InputForm[N@(myround[#, 3] & /@ RandomReal[{1, 10}, 10])]
where InputForm
makes it possible to copy/paste the output without the NumberMarks
following each real.
It seems there is no problem also to copy/paste the output of :
InputForm[
N@(myround[#, 3] & /@
RandomVariate[
MultinormalDistribution[{-1.5, 0}, {{2, 0}, {0, 1}}], {10}])]
###2/
Whenever you need to remove NumberMarks
you can run for example :
InputForm[{8.953`, 4.801`, 8.098`, 5.558`, 1.856`, 8.602`, 9.468`, 4.458`,
4.538`, 3.348`}, NumberMarks->False]
{8.953, 4.801, 8.098, 5.558, 1.856, 8.602, 9.468, 4.458, 4.538, 3.348}
which can be copied then pasted without the NumberMarks
.