function [ ch, seed ] = ch_uniform ( clo, chi, seed ) %% CH_UNIFORM returns a scaled pseudorandom CH. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 21 May 2008 % % Author: % % John Burkardt % % Parameters: % % Input, character CLO, CHI, the minimum and maximum acceptable characters. % % Input, integer SEED, a seed for the random number generator. % % Output, character CH_UNIFORM, the randomly chosen character. % % Output, integer SEED, a seed for the random number generator. % if ( seed == 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'CH_UNIFORM - Fatal error!\n' ); fprintf ( 1, ' Input SEED = 0!\n' ); error ( 'CH_UNIFORM - Fatal error!' ); end [ t, seed ] = r8_uniform_01 ( seed ); ch = floor ( clo + t * ( chi + 1 - clo ) ); ch = max ( ch, clo ); ch = min ( ch, chi ); return end