@@ -844,7 +844,7 @@ def broadcast_ghosts(self, output_nonconst_dims):
844844 comm_sub .Bcast (data , root = 0 )
845845 return data
846846
847- def fill_random (self , layout = None , seed = None , chunk_size = 2 ** 20 , distribution = 'standard_normal' , ** kw ):
847+ def fill_random (self , layout = None , scales = None , seed = None , chunk_size = 2 ** 20 , distribution = 'standard_normal' , ** kw ):
848848 """
849849 Fill field with random data. If a seed is specified, the global data is
850850 reproducibly generated for any process mesh.
@@ -853,6 +853,8 @@ def fill_random(self, layout=None, seed=None, chunk_size=2**20, distribution='st
853853 ----------
854854 layout : Layout object, 'c', or 'g', optional
855855 Layout for setting field data. Default: current layout.
856+ scales : number or tuple of numbers, optional
857+ Scales for setting field data. Default: current scales.
856858 seed : int, optional
857859 RNG seed. Default: None.
858860 chunk_size : int, optional
@@ -864,6 +866,12 @@ def fill_random(self, layout=None, seed=None, chunk_size=2**20, distribution='st
864866 **kw : dict
865867 Other keywords passed to the distribution method.
866868 """
869+ init_layout = self .layout
870+ # Set scales if requested
871+ if scales is not None :
872+ self .preset_scales (scales )
873+ if layout is None :
874+ self .preset_layout (init_layout )
867875 # Set layout if requested
868876 if layout is not None :
869877 self .preset_layout (layout )
0 commit comments