Skip to main content
Commonmark migration
Source Link

#Python, 135 130 bytes

Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

#Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013@jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

#Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

#Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

Added @jimmy23013’s suggestion
Source Link
J F
  • 301
  • 1
  • 12

#Python, 135135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if(x**2+y**2)**0.5<=1 x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

#Python, 135 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if(x**2+y**2)**0.5<=1:p=x,y
print'(%.2f, %2f)'%p

#Python, 135 130 bytes

from random import*
def r():return uniform(-1,1)
p=[]
while not p:
    x,y=r(),r()
    if x**2+y**2<=1:p=x,y
print'(%.2f, %2f)'%p

Removed the **0.5 thanks to @jimmy23013’s suggestion (because it is a unit circle, I am now checking whether the distance squared between (x, y) and (0, 0) is equal to 12. This is the same thing).

This also freed me to remove the parentheses.

Source Link
J F
  • 301
  • 1
  • 12
Loading