// Copyright (C) 2022 Aravinth Manivannan // SPDX-FileCopyrightText: 2023 Aravinth Manivannan // // SPDX-License-Identifier: AGPL-3.0-or-later /// Get random string of specific length pub(crate) fn get_random(len: usize) -> String { use rand::{distributions::Alphanumeric, rngs::ThreadRng, thread_rng, Rng}; use std::iter; let mut rng: ThreadRng = thread_rng(); iter::repeat(()) .map(|()| rng.sample(Alphanumeric)) .map(char::from) .take(len) .collect::() }