Random numbers – language C – edge in ascending order

I need to create a program that generates random numbers using the rand () function and sorts them in ascending order.

my code:

#include   //Entradas e saidas
#include   //Configuracao de entradas e saidas
#include  //Biblioteca rand max
#include    //funcao rand

int main(void) {
    int Q, y, aux, v(100), j;
    printf("nSera gerado 100 numeros aleatorios:n");
    for(Q=1; Q<=100; Q++){
        v(Q)=(rand()%200);
        printf("%d ", v(Q));
    }
    for (Q = 0; Q < 100; Q++){
        for(y = 1; j < 100; j++){
            if (v(Q) > v(j)){
                aux = v(Q);
                v(Q) = v(j);
                v(j) = aux;
            }
        }
    }
    printf("nNumeros em ordem crescente: n");
    for(Q=0;Q<=100;Q++){
        printf("%d ", v(Q));
    }
}

How could a WPA2 WLAN with a random password with more than 40 characters be penetrated?

I can confirm an intrusion from an unknown MAC address (identified as a Realtek device), retrieve a new, valid IP from the DHCP pool, and use the network for about 1 hour.

The network is WPA2 – 1 for 2.4 GHz and 5 GHz with the same password. The 2.4 GHz network also includes a TP Link Extender that creates its own SSID, but with the same password. So a total of 3 networks with the same password.

This over 40 random password was set less than 10 days ago. It's certainly random, with the recommended mix of uppercase and lowercase letters, numbers and symbols generated by a reputed password manager. There are no proximal patterns that I can find or imagine, and no signs have been repeated – that's what I've taken care of.

How is it possible that this network has been compromised? so fast?

  1. In theory, is it even possible to crack a 40-digit random password IN 10 DAYS with fewer than a few hundred multi-GPU setups? I do not think anyone wants to "get me" so much.

  2. Is it possible that a network will enter / enter without knowing the password? A version of the KRACK attack or similar targeting the router or perhaps the repeater.

  3. Is it possible to perform a LOCAL attack similar to KRACK or BlueBorne on any of the 10 client devices where the intruder could have read the WiFi password from one of these clients and compromised the network?

  4. In addition to (WPA2-PSK-CCMP) -TKIP, the extended network displays a security setting of (WPA-PSK-CCMP) -TKIP. While the original networks only have (WPA2-PSK-CCMP) -TKIP. Is this a potential security hole?

I know that this is a broad question – but I am dealing with a very real intervention here. I would like to limit the possibilities and then the question based on community guidance

Small addendum: The clients are a typical mix of Android, iOS, streaming sticks, Windows, Mac, printer. No other IoT or Linux. There are some Bluetooth accessories scattered around.

Use of the HW random number generator as entropy source

At the moment I use haveged on my server as source of entropy.

My server is used as a KVM hypervisor to run virtual machines.

I did not use haveged At the beginning, I noticed that the VMs emptied the entropy pool from the server. Sometimes, when VMs started, SSH waited for enough entropy (to generate session keys, I think).

Now with havegedI do not have this problem anymore.

But I would like to try using a HW random generator. I do not say haveged is bad, but a true HW random number generator can only improve entropy.
I've seen some HW-RNG working on the Geiger counter, some picking up sounds from the microphone, and so on.

Which are the most meaningful to use?
Could someone maybe recommend a particular one?

Ideally, I want it to be connected via the serial port. Second best would be via USB.

The Pearson correlation coefficient ρ (x, y) of two random variables x and y with var (x) = var (y)

Thank you for your reply to Mathematics Stack Exchange!

  • Please be sure too answer the question, Provide details and share your research!

But avoid

  • Ask for help, clarify or respond to other answers.
  • Make statements based on opinions; Cover them with references or personal experience.

Use MathJax to format equations. Mathjax reference.

For more information, see our tips for writing great answers.

Probability – Does the linear interpolation of two random domains receive the randomness?

I have generated a number z from one area (x, y) and want to assign z to another area (p, q).

This can be achieved by linear interpolation as follows:
https://www.mathworks.com/matlabcentral/answers/379380-assignment-from-one-all-all-number-in- one-area-to another area

and here:

https://stackoverflow.com/questions/58773896/interpolation-in-java-mapping-a-random-number-from-one-range-to-another

The relationship I want to achieve is something like this:

01, 02, 03, 04, 05, 06, 07, 08, 09, 10
25, 25, 25, 26, 26, 26, 27, 27, 27, XX

Where x, y is the range 1-10, p, q is 25-27

If z = 7, the & # 39; equivalent would be & # 39; in the second range about 27, but this would require that one of the intervals be rounded up or down so that it is not completely accurate.

My question is, does the above relationship be achieved through linear interpolation, and if so, preserves & # 39; the relationship the randomness?

For example, if I had rolled a dice, the second interpolated value would be the same "cube", so to speak, but in the context of a cube with more sides?

Random object identifier in Rust

For convenience and to learn more about Rust (this is my first attempt to release a box), I created a random generator named "objid" on crates.io.

extern crate getopts;
extern crate rand;
use getopts::Options;
use rand::Rng;
use std::env;

fn print_usage(program: &str, opts: Options) {
    let brief = format!("Usage: {}", program);
    print!("{}", opts.usage(&brief));
}

fn print_version() {
    let brief = format!(
        "Version: {}",
        "$Id: 3c044d47e723cd4e079e402dab29128b3631dbc6 $"
            .replace("$Id: ", "")
            .replace(" $", "")
    );
    print!("{}", &brief);
}

fn r(x: i64) -> i64 {
    x & (std::i64::MAX - 1)
}

fn main() {
    let args: Vec = env::args().collect();
    let program = args(0).clone();

    let mut opts = Options::new();
    opts.optflag("h", "help", "print this help menu");
    opts.optflag("v", "version", "print the version id");
    opts.optflag("c", "clean", "print nothing but the objid");

    let matches = match opts.parse(&args(1..)) {
        Ok(m) => m,
        Err(f) => panic!(f.to_string()),
    };

    if matches.opt_present("h") {
        print_usage(&program, opts);
        return;
    }

    if matches.opt_present("v") {
        print_version();
        return;
    }

    let b62digits = String::from("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
    let mut rng = rand::thread_rng();
    let mut rng63 = r(rng.gen::());
    let mut str = String::from("_");
    while rng63 != 0 {
        let d: i64 = rng63 % 62;
        rng63 = rng63 / 62;
        str.push(b62digits.chars().nth(d as usize).unwrap());
    }

    let mut text = format!("{}", "Random object id: ");

    if matches.opt_present("c") {
        text = format!("{}", "");
    }

    println!("{}{}", text, str);
}

I'm a Rust freshman so there are likely to be mistakes and opportunities to improve with the above.

The entire project is in my Github repository.

Show contribution of a random author

I would like to display a post by random author ID like this:

author_name

How can I get a random author and then display 10 posts by this author?
And when I refresh the page, another author is displayed with his post.

My posting feature:

function author_post($total_post, $orderby, $random_author_id){
    global $post;
    $original_post = $post;
    $args = array(
        'post_type'              => 'post',
        'orderby'                => $orderby,
        'posts_per_page'         => $total_post,
        'author'                 => $random_author_id
    );
    $get_posts_query = new WP_Query( $args );
        while ( $get_posts_query->have_posts() ) : $get_posts_query->the_post()?>

Sorry, I speak a little English, I hope you understand 🙂