#! /usr/bin/env python # def line01_sample ( n, seed ): #*****************************************************************************80 # ## LINE01_SAMPLE samples the unit line in 1D. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 22 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(N), the points. # from r8vec_uniform_01 import r8vec_uniform_01 x, seed = r8vec_uniform_01 ( n, seed ) return x, seed def line01_sample_test ( ): #*****************************************************************************80 # ## LINE01_SAMPLE_TEST tests LINE01_SAMPLE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 22 June 2015 # # Author: # # John Burkardt # import platform from r8vec_print import r8vec_print print ( '' ) print ( 'LINE01_SAMPLE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' LINE01_SAMPLE samples the unit line.' ) n = 10 seed = 123456789 x, seed = line01_sample ( n, seed ) r8vec_print ( n, x, ' Sample points in the unit line.' ) # # Terminate. # print ( '' ) print ( 'LINE01_SAMPLE_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) line01_sample_test ( ) timestamp ( )