Hello Wolfram Community,
I have a function that takes two parameters and is essentially supposed to return one of two things: "line Crossed" or "no line Crossed". However with this current function I am getting Null as my output. Why is this and how can I achieve my desired output. Here is the code:
needleCross[length_, distance_] := {
Block[
{midPoint = RandomReal[distance],
rotationAngle = RandomReal[{-Pi/2, Pi/2}]},
xCoordLinePoints = {midPoint - (Cos[rotationAngle]*length/2),
midPoint + (Cos[rotationAngle]*length/2)}];
If[xCoordLinePoints[[1]] <= 0 || xCoordLinePoints[[2]] >= distance,
Print["Line Crossed"], Print["No Line Crossed"]]}
any advice would help!
Thanks