I was recently given a task to accomplish which i failed. I don’t usually ask for logic but today i am compalled to ask.Here is the task.
I am not allowed to use rand() function of php. instead i can use this function.
function getRandom()
{
return rand(1,5);
}
OK i tried this function but it is bound to return value from 3 to 7.
function getMoreRandom()
{
$value = getRandom();
return $value + 2;
}
Now i have to define a php function which can return me random number with the range 1 to 7. How can i do this?
1 Answer