25 ms·
Code used Rust, interesting, I have come to expect Python and just recently used the open source version of Matlab called Octave.
by peter_retief 5y ago
Code used Rust, interesting, I have come to expect Python and just recently used the open source version of Matlab called Octave.
- lucasfcosta 5y agoAuthor here. I thought no one was going to make comments about Rust, but I just loved using it for this post. Thanks, Peter :)
- peter_retief 5y agoI have been looking for an excuse to use Rust, thank you for the interesting post on all counts...
- staplung 5y agoRust is cool and all but I feel like the code examples would have been a bit more didactic in e.g. Julia since there's less distracting complexity in those types of languages. Here's a somewhat equivalent translation of the first snippet: rolls = 1_000_000 n_sides = 6 sevens = 0 for _ in 1:rolls if rand(1:n_sides) + rand(1:n_sides) == 7 sevens += 1 end end println(sevens/rolls * 100)