My Rust solution
ApproachCalculate the area of each rectangle and use that as weight when picking rects, to choose a point from. This ensures that each point has the same chance
# Approach
Calculate the area of each rectangle and use that as weight when picking rects, to choose a point from. This ensures that each point has the same chance of being picked. 


# Note
sometimes, while optimizing the code, it would just say the solution was wrong, even though it hasn't changed logically. On the second run it worked as it should. 
This is why i don't like randomness in questions like this. you could just get unlucky and get denied, even though you're correct...


# Code
```rust []
use rand::distributions::{Distribution, WeightedIndex};
use rand::Rng;

struct Solution {
    rects: WeightedList<Rect>,
}
struct WeightedList<T> {
    items: Vec<T>,
    distribution: WeightedIndex<f64>,
}
#[derive(Clone,Copy, Debug)]
struct Rect{
    a:i32,
    b:i32,
    x:i32,
    y:i32,
}
#[derive(Clone,Copy, Debug)]
struct Point {
    x: i32,
    y: i32,
}

impl<T> WeightedList<T> {
    fn new(items: Vec<T>, weights: Vec<f64>) -> Self {
        assert_eq!(items.len(), weights.len());
        let distribution = WeightedIndex::new(&weights).unwrap();
        WeightedList { items, distribution }
    }
}

impl<T> Distribution<T> for WeightedList<T> where T: Clone {
    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T {
        self.items[self.distribution.sample(rng)].clone()
    }
}

impl Point {
    fn to_vec(&self)-> Vec<i32>{
        vec![self.x, self.y]
    }
}

impl Rect {
    fn from_slice(x: &[i32]) -> Self {
        Rect {
            a: x[0],
            b: x[1],
            x: x[2],
            y: x[3],
        }
    }
    fn get_point_inside<R: Rng + ?Sized>(&self, rng: &mut R)-> Point {
        let x = rng.gen_range(self.a..=self.x);
        let y = rng.gen_range(self.b..=self.y);
        Point{x,y}
    }
    fn get_size(&self)-> f64 {
        ( (self.x - self.a+1) * (self.y - self.b+1)  ) as f64 // do not forget the +1 here, since we are looking for points, including the border
    }
}

impl Solution {
    fn new(rects: Vec<Vec<i32>>) -> Self {
        let (rects, weights) = rects.into_iter().map(|x|{
            let rect = Rect::from_slice(&x);
            (rect, 1.0 + rect.get_size() )
        }).collect();
        Self{
            rects: WeightedList::new(rects, weights)
        }
    }
    
    fn pick(&self) -> Vec<i32> {
        use rand::Rng;
        let mut rng = rand::thread_rng();
        let rect = self.rects.sample(&mut rng);
        let point = rect.get_point_inside(&mut rng);
        point.to_vec()
    }
}

```
['Rust']