Generate Struct based on stat distribution

Hello,
I’m trying to generate a random data for a struct based on stat distribution. I think it should be a simple task, but probably i’m not knowing how to search for it. Spend a day and a half searching how to do it and still not working. Below some base code.

struct House
    Room::Int64                #20% 1 | 50% 2 | 20% 3 | 10% 4 or more
    Bathroom::Int64          #30% 1 | 50% 2 | 20% 3 or more
    Kitchen::Int64             #02% 0 | 98% 1
    LivingRoom::Int64      #30% 0 | 70% 1
    DiningRoom::Int64     #30% 0 | 70% 1
    Garage::Int64             #60% 0 | 40% 1
end

I really do need a direction here! Thanks in advance!!!

1 Like
using Distributions

function random_house()
    Room = rand(Categorical([0.2, 0.5, 0.2, 0.1]))
    Bathroom = rand(...)
    ...
    return House(Room, Bathroom, ...)
end
2 Likes