Control over proportions using randi (or something else )
Show older comments
Hi guys,
I have this line in code that defines a certain number of agents within the selected area
obj.agents = randi([0 1],obj.width, obj.height);
I want to control this parameter so I have a certain proportion of 0 and 1 randomly distributed within the area, like 30% of 0 and 70% of 1, and vice versa (so they still randomly distributed, but one is bigger than the other ).
Are there any relatively easy ways of doing it?
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!