From 3a8e5cdd4be643743b6d3c2e4a60915e0730b874 Mon Sep 17 00:00:00 2001 From: SymmetricChaos Date: Mon, 2 Oct 2023 20:59:52 -0400 Subject: [PATCH] more direct --- src/rng_panel/pcg_controls.rs | 3 +-- src/ui_elements.rs | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rng_panel/pcg_controls.rs b/src/rng_panel/pcg_controls.rs index 1f955fc1..3def0bad 100644 --- a/src/rng_panel/pcg_controls.rs +++ b/src/rng_panel/pcg_controls.rs @@ -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); diff --git a/src/ui_elements.rs b/src/ui_elements.rs index 1edfda09..2773ee9d 100644 --- a/src/ui_elements.rs +++ b/src/ui_elements.rs @@ -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; @@ -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 { +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) {