Created
February 6, 2015 03:16
-
-
Save 5nyper/b8d33feac4b7bebb9de0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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