working version
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
77
Cargo.lock
generated
Normal file
77
Cargo.lock
generated
Normal file
@@ -0,0 +1,77 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
||||
|
||||
[[package]]
|
||||
name = "chacha20"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.191"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
|
||||
dependencies = [
|
||||
"chacha20",
|
||||
"getrandom",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "rusty-pw"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"rand",
|
||||
]
|
||||
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "rusty-pw"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
rand = "0.10.3"
|
||||
16
src/main.rs
Normal file
16
src/main.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use rand::seq::IndexedRandom;
|
||||
use rand::RngExt;
|
||||
|
||||
const WORDS: &str = include_str!("../words.txt");
|
||||
|
||||
fn main() {
|
||||
let words: Vec<&str> = WORDS.lines().collect();
|
||||
|
||||
let mut rng = rand::rng();
|
||||
|
||||
let word = words.choose(&mut rng).expect("word list is empty");
|
||||
|
||||
let number = rng.random_range(0..10000);
|
||||
|
||||
println!("{}{:04}", word, number);
|
||||
}
|
||||
200
words.txt
Normal file
200
words.txt
Normal file
@@ -0,0 +1,200 @@
|
||||
apple
|
||||
beach
|
||||
brave
|
||||
bread
|
||||
brick
|
||||
bunny
|
||||
cabin
|
||||
candy
|
||||
chair
|
||||
chalk
|
||||
cloud
|
||||
clock
|
||||
crane
|
||||
dance
|
||||
daisy
|
||||
dream
|
||||
eagle
|
||||
earth
|
||||
field
|
||||
flame
|
||||
flute
|
||||
frost
|
||||
fruit
|
||||
giant
|
||||
glove
|
||||
grape
|
||||
grass
|
||||
happy
|
||||
heart
|
||||
horse
|
||||
house
|
||||
jelly
|
||||
kayak
|
||||
lemon
|
||||
light
|
||||
lunch
|
||||
magic
|
||||
maple
|
||||
melon
|
||||
mouse
|
||||
music
|
||||
ocean
|
||||
olive
|
||||
otter
|
||||
paint
|
||||
panda
|
||||
paper
|
||||
peach
|
||||
pearl
|
||||
piano
|
||||
pilot
|
||||
plant
|
||||
puppy
|
||||
quilt
|
||||
rainy
|
||||
river
|
||||
robot
|
||||
smile
|
||||
snail
|
||||
snowy
|
||||
spoon
|
||||
stamp
|
||||
story
|
||||
sunny
|
||||
sweet
|
||||
table
|
||||
tiger
|
||||
toast
|
||||
tulip
|
||||
train
|
||||
trail
|
||||
uncle
|
||||
vivid
|
||||
water
|
||||
whale
|
||||
wheel
|
||||
young
|
||||
zebra
|
||||
bloom
|
||||
brush
|
||||
coral
|
||||
cheer
|
||||
dizzy
|
||||
fairy
|
||||
globe
|
||||
honey
|
||||
ivory
|
||||
jolly
|
||||
koala
|
||||
llama
|
||||
mango
|
||||
noble
|
||||
orbit
|
||||
prize
|
||||
raven
|
||||
swing
|
||||
tweet
|
||||
wagon
|
||||
yummy
|
||||
zesty
|
||||
acorn
|
||||
album
|
||||
alarm
|
||||
amber
|
||||
apron
|
||||
arrow
|
||||
badge
|
||||
baker
|
||||
bacon
|
||||
bench
|
||||
berry
|
||||
bison
|
||||
board
|
||||
brain
|
||||
camel
|
||||
canoe
|
||||
cedar
|
||||
charm
|
||||
chess
|
||||
chime
|
||||
clean
|
||||
climb
|
||||
coast
|
||||
comet
|
||||
cream
|
||||
crown
|
||||
diary
|
||||
dough
|
||||
drums
|
||||
elbow
|
||||
fence
|
||||
ferry
|
||||
finch
|
||||
flock
|
||||
floor
|
||||
focus
|
||||
fresh
|
||||
gecko
|
||||
goose
|
||||
grain
|
||||
gravy
|
||||
guide
|
||||
hello
|
||||
hiker
|
||||
hobby
|
||||
hotel
|
||||
humor
|
||||
igloo
|
||||
image
|
||||
jeans
|
||||
juice
|
||||
kitty
|
||||
laugh
|
||||
learn
|
||||
level
|
||||
lilac
|
||||
linen
|
||||
lucky
|
||||
marsh
|
||||
medal
|
||||
metal
|
||||
moose
|
||||
mural
|
||||
nurse
|
||||
oasis
|
||||
onion
|
||||
opera
|
||||
party
|
||||
pasta
|
||||
pecan
|
||||
pedal
|
||||
penny
|
||||
piece
|
||||
pizza
|
||||
plane
|
||||
plush
|
||||
poppy
|
||||
quail
|
||||
quest
|
||||
quiet
|
||||
radio
|
||||
ranch
|
||||
reach
|
||||
ridge
|
||||
robin
|
||||
salad
|
||||
scarf
|
||||
scoop
|
||||
sheep
|
||||
shelf
|
||||
shell
|
||||
shine
|
||||
skate
|
||||
sleep
|
||||
slide
|
||||
snack
|
||||
solar
|
||||
sound
|
||||
space
|
||||
squid
|
||||
Reference in New Issue
Block a user