Skip to content

Commit

Permalink
image.py: Make the seed argument of random be optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
schwehr authored and Google Earth Engine Authors committed Aug 22, 2024
1 parent 385520a commit d2a8215
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/ee/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,8 @@ def projection(self) -> ee_projection.Projection:

@staticmethod
def random(
seed: _arg_types.Integer, distribution: Optional[_arg_types.String] = None
seed: Optional[_arg_types.Integer] = None,
distribution: Optional[_arg_types.String] = None,
) -> Image:
"""Returns an image with a random number at each pixel location.
Expand Down
9 changes: 9 additions & 0 deletions python/ee/tests/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3319,6 +3319,15 @@ def test_random(self):
result = json.loads(expression.serialize())
self.assertEqual(expect, result)

def test_random_default_args(self):
expect = make_expression_graph({
'arguments': {},
'functionName': 'Image.random',
})
expression = ee.Image.random()
result = json.loads(expression.serialize())
self.assertEqual(expect, result)

def test_random_visualizer(self):
expect = make_expression_graph({
'arguments': {
Expand Down

0 comments on commit d2a8215

Please sign in to comment.