#! /usr/bin/env python # def hypercube01_sample ( m, n, seed ): #*****************************************************************************80 # ## HYPERCUBE01_SAMPLE samples points in the unit hypercube in M dimensions. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 22 June 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer M, the spatial dimension. # # Input, integer N, the number of points. # # Input/output, integer SEED, a seed for the random # number generator. # # Output, real X(M,N), the points. # from r8mat_uniform_01 import r8mat_uniform_01 x, seed = r8mat_uniform_01 ( m, n, seed ) return x, seed def hypercube01_sample_test ( ): #*****************************************************************************80 # ## HYPERCUBE01_SAMPLE_TEST tests HYPERCUBE01_SAMPLE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 22 June 2015 # # Author: # # John Burkardt # import platform from r8mat_transpose_print import r8mat_transpose_print print ( '' ) print ( 'HYPERCUBE01_SAMPLE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' HYPERUBE01_SAMPLE samples the unit hypercube' ) print ( ' in M dimensions.' ) m = 3 n = 10 seed = 123456789 x, seed = hypercube01_sample ( m, n, seed ) r8mat_transpose_print ( m, n, x, ' Sample points in the unit hypercube.' ) # # Terminate. # print ( '' ) print ( 'HYPERCUBE01_SAMPLE_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) hypercube01_sample_test ( ) timestamp ( )