Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Veinhelm committed Aug 31, 2021
0 parents commit ff6ceb9
Show file tree
Hide file tree
Showing 9 changed files with 728 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
*.lock
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "Whatinizer"
version = "1.0.0"
edition = "2018"
authors = ["Veinhelm"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.4"
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Whatinizer
A simple little application I made to test with Rust.
All it does is just scramble the letters in a string typed in.
3 changes: 3 additions & 0 deletions build-release.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
cargo build --release
pause
3 changes: 3 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
cargo build
pause
3 changes: 3 additions & 0 deletions run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
cargo run
pause
28 changes: 28 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#![allow(non_snake_case)]
use rand::seq::SliceRandom;

fn pause() {
extern "C" {
fn _getch() -> std::os::raw::c_int;
}

println!("<< Press Any Key >>");
let _ = unsafe { _getch() };
}

fn main() {
let mut rng = rand::thread_rng();
let mut inputtext = String::new();

println!("Enter text to Whatinize.");
std::io::stdin().read_line(&mut inputtext).expect("Did not enter a correct string");

let mut inputtextbytes = inputtext.into_bytes();
inputtextbytes.shuffle(&mut rng);
let outputtext = String::from_utf8(inputtextbytes).unwrap();

println!("\nWhatinized text: "); // On a different line or else it will scramble this as well for some reason
println!("{}", outputtext);
println!("");
pause();
}

0 comments on commit ff6ceb9

Please sign in to comment.