Running…
rand(10^9)
will lead my jupyter notebook session to crash and autorestart on my PC.
Q : Is this a limit to be expected using Rand on a I3 - single thread - or are there workaround to push the rand() function a little bit higher ?
Tks
Running…
rand(10^9)
will lead my jupyter notebook session to crash and autorestart on my PC.
Q : Is this a limit to be expected using Rand on a I3 - single thread - or are there workaround to push the rand() function a little bit higher ?
Tks
10^9 floating point numbers is 8 GB.
How much memory is in your machine?
You’re asking for about 7.5 gigabytes of data. You therefore are running out of ram.
Thanks guys, oh ok, I can add another 8GB…
So, can you tell how can one get this estimate of 7.5 gig of Data if not too complex ?
Thanks
yes, its only 8GB at the moment
A Float is 8 bytes. You want 10^9 of them.
Ok, I get it, thanks for this help. !
Will reboot with more ram.
Thanks…
Do you really need those 10^9 numbers at once ? If not you should probably use a loop. E.g.
julia> function mean_of_rand(N)
s = 0.0
for i=1:N
s += rand()
end
s/N
end
julia> @time mean_of_rand(1e9)
2.861199 seconds
0.499999456741799
Sure, I was thinking so…and no, I do not have a case where I do need that much, I’m just testing some machine limits and got very good help from everyone here - as usual should I say. Top Forum helpers !
function mean_of_rand(N) is the way to go if needed !
… “mean of ran” keeps working at 10^10 on the other hand !
Thanks to all.
have a nice week !
To call this function so often is also quite expensive. Lower cost is to generate random data in chunks.