This problem investigates a two-level randomization problem useful tor applications lke video game programming (Think: Programming a computer on easy" to play against you at tic-tac-loe, where it...
This problem investigates a two-level randomization problem useful tor applications lke video game programming (Think: Programming a computer on easy" to play against you at tic-tac-loe, where its strategy is to place a mark in a random location.) rite a function called randLocation that takes a vector of any length as its input. The function places a 0 at a random location in the array such that every location is as equally likely The function outputs the new vector You may submit your work as many times as you want. Try to get 100%) Your Function C Reset MATLAB Documentation function v - randLocation(v) nunElements SYOUR CODE HERE. Use the length) function to get the number of elements in the input vector randi nd-%YOUR CODE HERE, use the randi() function to generate a random index between 1 and nume1ements OUR CODE HERE. Assign the element in v located at randInd to be zero. s end Code to call your function С Reset 1vector 1:28 vector_new- randLocation(vector) vector-3 6.22; 11; 8.95; 13; 541; vector_new-randLocation(vector) Run Function
This problem investigates a two-level randomization problem useful tor applications lke video game programming (Think: Programming a computer on easy" to play against you at tic-tac-loe, where its strategy is to place a mark in a random location.) rite a function called randLocation that takes a vector of any length as its input. The function places a 0 at a random location in the array such that every location is as equally likely The function outputs the new vector You may submit your work as many times as you want. Try to get 100%) Your Function C Reset MATLAB Documentation function v - randLocation(v) nunElements SYOUR CODE HERE. Use the length) function to get the number of elements in the input vector randi nd-%YOUR CODE HERE, use the randi() function to generate a random index between 1 and nume1ements OUR CODE HERE. Assign the element in v located at randInd to be zero. s end Code to call your function С Reset 1vector 1:28 vector_new- randLocation(vector) vector-3 6.22; 11; 8.95; 13; 541; vector_new-randLocation(vector) Run Function