Distribute randomly robots in the workspace
Show older comments
I have a set of robots N. The workspace where robots operate is divided on compartments. How to distribute robots uniformly between compartments.
For example,
If I have 16 robots and 4 compartments, than after distribution every compartment will have 4 robots.
If I have 17 robots and 4 compartments, than after distribution 3 random compartments will contain 4 robots and 1 compartment will contain 5 robots.
Answers (2)
KSSV
on 30 Jan 2020
N = 16 ;
d = reshape(randperm(N),4,4)
1 Comment
Veronika Mazulina
on 30 Jan 2020
KSSV
on 30 Jan 2020
N = 16 ;
d = reshape(randperm(N),4,4)
Categories
Find more on Robotics System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!