MATLAB: What does this code represents? and why rand() has no value between parentheses

code explanationMATLAB

function [outcome]=customer
x=rand() ;
if x <= 0.2
outcome = 1 ;
else
outcome = 0;
end

Best Answer

It defines a function which returns either 1 or 0, where 1 has ~=20% probability. Simpler code:
customer = @()+(rand(1)<=0.2);
"why rand() has no value between parentheses?"
Did you read the rand documentation? It explains the different rand syntaxes.