erickt/rust-zmq — pull request #21 by dwrensha (2013-12-29 20:57:11+00:00)
Title: use std::rand::weak_rng() in weather server example

The weather server example has two problems:

1) The pseudorandom generation for zipcode, temperature, and humidity is incorrect. Note that `random::() % 215` can evaluate to any integer in the interval (-215, 215) --- not just the positive ones.

2) Rust's default random number generator is slower than libc's rand(), which is used by the zguide C implementation.

Fixing these two problems speeds up the server by more than a factor of two on my system.