logo

... numba: conclusion



Notes

Here's the monte carlo example from the video.

import random

@nb.njit()
def monte_carlo_pi_fast(nsamples):
    acc = 0
    for i in range(nsamples):
        x = random.random()
        y = random.random()
        if (x ** 2 + y ** 2) < 1.0:
            acc += 1
    return 4.0 * acc / nsamples

For more information on supported types, see the docs here.

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.