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