Need help inserting numbers randomly into a matrix

part of my project requires me to insert a random number of pegs onto a "board" of zeros with size determined by the player Right now the player is able to determine the columns rows and max number of pegs the program picks a random number of pegs but I need help with how to place that number of pegs with a randomly chosen -1 or 1 value randomly on the board Thanks in advance

 채택된 답변

dpb
dpb 2014년 3월 11일
doc randperm % I'll leave you to determine how that helps... :)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 3월 11일

답변:

dpb
2014년 3월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by