Skip to content

Commit

Permalink
more direct
Browse files Browse the repository at this point in the history
  • Loading branch information
SymmetricChaos committed Oct 3, 2023
1 parent ee2f46f commit 3a8e5cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/rng_panel/pcg_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ impl ClassicRngFrame for PcgFrame {
ui.add_space(16.0);

if ui.button("Generate").clicked() {
let v = generate_random_nums(&mut self.rng, self.n_randoms);
self.randoms = v.iter().map(|x| x.to_string()).join(", ");
self.randoms = generate_random_nums(&mut self.rng, self.n_randoms);
self.state_string = self.rng.state.to_string();
}
ui.text_edit_multiline(&mut self.randoms);
Expand Down
5 changes: 3 additions & 2 deletions src/ui_elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use codes::binary_to_text::BinaryToTextMode;
use eframe::egui::RichText;
use egui::{Color32, DragValue, Response, TextStyle, Ui};
use egui_extras::{Column, TableBuilder};
use itertools::Itertools;
use rngs::ClassicRng;
use std::fmt::Display;
use utils::text_functions::filter_string;
Expand Down Expand Up @@ -272,12 +273,12 @@ pub fn filter_and_parse_u64(number: &mut u64, string: &mut String) {
}
}

pub fn generate_random_nums(rng: &mut dyn ClassicRng, n: usize) -> Vec<u32> {
pub fn generate_random_nums(rng: &mut dyn ClassicRng, n: usize) -> String {
let mut vec = Vec::with_capacity(n);
for _ in 0..n {
vec.push(rng.step())
}
vec
vec.iter().map(|x| x.to_string()).join(", ")
}

pub fn binary_to_text_input_mode(ui: &mut egui::Ui, current_value: &mut BinaryToTextMode) {
Expand Down

0 comments on commit 3a8e5cd

Please sign in to comment.