Skip to content

Instantly share code, notes, and snippets.

@5nyper
Created February 6, 2015 03:16
Show Gist options
  • Save 5nyper/b8d33feac4b7bebb9de0 to your computer and use it in GitHub Desktop.
Save 5nyper/b8d33feac4b7bebb9de0 to your computer and use it in GitHub Desktop.
extern crate iron;
use iron::prelude::*;
use iron::status;
use std::rand::{thread_rng, Rng};
fn main() {
Iron::new(|&: _: &mut Request| {
let mut rng = thread_rng();
let mut srt = "".to_string();
let gen = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
for _i in range(0i, 10i) {
let n: uint = rng.gen_range(0u, gen.len());
srt.push(gen.char_at(n));
}
Ok(Response::with((status::Ok, srt)))
}).listen("0.0.0.0:80").unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment