code: def test_permutation():
      x = permutation(10)
  
      assert x.shape == (10,)
      assert isinstance(x.op, TensorPermutation)
  
      x = tile(x)
  
      assert len(x.chunks) == 1
      assert isinstance(x.chunks[0].op, TensorPermutation)
  
      arr = from_ndarray([1, 4, 9, 12, 15], chunk_size=2)
      x = permutation(arr)
  
      assert x.shape == (5,)
      assert isinstance(x.op, TensorPermutation)
  
      x = tile(x)
      arr = tile(arr)
  
      assert len(x.chunks) == 3
      assert np.isnan(x.chunks[0].shape[0])
      assert (
          x.chunks[0].inputs[0].inputs[0].inputs[0].key
          == arr.chunks[0].data.key
      )
  
      arr = rand(3, 3, chunk_size=2)
      x = permutation(arr)
  
      assert x.shape == (3, 3)
      assert isinstance(x.op, TensorPermutation)
  
      x = tile(x)
      arr = tile(arr)
  
      assert len(x.chunks) == 4
      assert np.isnan(x.chunks[0].shape[0])
      assert x.chunks[0].shape[1] == 2
      assert x.cix[0, 0].op.seed == x.cix[0, 1].op.seed
      assert (
          x.cix[0, 0].inputs[0].inputs[0].inputs[0].op.seed
          == x.cix[1, 0].inputs[0].inputs[0].inputs[0].op.seed
      )
  
      with pytest.raises(np.AxisError):
          pytest.raises(permutation("abc"))
  
file_path: mars/mars/tensor/random/tests/test_random.py
imports: import numpy
  import pytest
  from ....core import tile
  from ....serialization import serialize, deserialize
  from ....serialization.serializables import Serializable
  from ...datasource import tensor
  from ..None import beta, rand, choice, multivariate_normal, randint, randn, permutation, TensorPermutation, shuffle, RandomState
  from ..core import RandomStateField
label_desc: Use image node_id 8 for calling a global function with example usage: test_permutation() without return types