home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilsm
/
numbergen
/
!NumberGen
/
!Help
< prev
next >
Wrap
Text File
|
1995-08-16
|
10KB
|
219 lines
ABOUT THIS PROGRAM
---------------------------------------------------------------------------
Name : NumberGen
Version : 1.01 (06 Aug 1995)
Purpose : Generate random numbers
Author : Andrew Berry
Licence : Freeware. Please see conditions at the end of this file.
PURPOSE
---------------------------------------------------------------------------
This program can be used to generate lists of random numbers, either for
general or statistical use (e.g. random sampling). Although random integers
can be generated using
FOR loop%=1 T0 10
PRINT RND(20)
NEXT loop%
this program offers full control over the range of numbers, the accuracy
(i.e. the number of decimal places) and the output type.
USING THE PROGRAM
---------------------------------------------------------------------------
The main window contains various options which will affect which numbers
are selected, and also the way in which they will be saved. It is opened by
clicking on the icon bar icon.
SETTING THE RANGE
---------------------------------------------------------------------------
'Number of values' determines the number of random numbers which will be
generated (sample size). The lower and upper limits are inclusive and are
used to specify the range within which the numbers will be generated.
Values can be typed into the first three boxes, or the up/down icons can be
used to increase or decrease the value in the box by one.
GENERAL OPTIONS
---------------------------------------------------------------------------
There are two accuracy settings. Selecting 'Integers only' will only allow
whole numbers to be generated. Selecting the second option causes numbers
to be generated to the number of decimal places shown. This can be altered
using the up/down icons.
'Show percentage hourglass' shows how far the operation has progressed and
'Display numbers during creation' prints the numbers on screen as they are
generated. Both these options slow down the creation of the file, the
second more considerably than the first.
OUTPUT TYPE
---------------------------------------------------------------------------
The final option in the main window is used to select the output type. The
formats are as follows:
Text : Number followed by a newline character (ASCII 10). This is the
default format and should be used if you only need to display the
numbers and not reload them into another program.
Data : As described below. Use this format if you will be loading the
numbers into a BASIC (or other) program. You will not be able to
display the numbers directly on the screen from a data file.
CSV : Number in quotes followed by CR (&0A). You should be able to load
this into most databases and other programs to analyse the
numbers.
FILETYPE-SPECIFIC OPTIONS
---------------------------------------------------------------------------
Clicking on 'Create list' or pressing Return in the 'Upper limit' icon will
open the save window for the save type selected (text, data or CSV). Text
and CSV have no options, and the file can be saved immediately in the
normal way.
There are two options which are for data output only. The data can either
be saved as numbers or strings. If 'Numbers' is selected then all the
numbers are saved as floating point numbers. Each number is saved using the
BASIC command PRINT#, and so to display the contents of the file from BASIC
the following could be used:
REM open file with handle file%
REPEAT
INPUT#file%,a
PRINT a
UNTIL EOF#file%
REM close file
You must ensure that floating point variables are used when re-loading data
files, as any decimal places will be lost if integer variables are used.
If 'Strings' is selected then each number will be converted to a string and
saved, again using PRINT#. This option is only really suitable if the data
is to be read into another program for display only. If the numbers will
be needed in any calculations then the 'Numbers' options should be used.
The following should be used to display the contents of data files if
the numbers have been saved as strings:
REM open file with handle file%
REPEAT
INPUT#file%,a$
PRINT a$
UNTIL EOF#file%
REM close file
The second option for data output determines whether the number of values
should be inserted at the start of the file before any data. If this is
selected then an integer will be inserted as the first data item. This
should be read so that you know how many values to load.
REM open file with handle file%
INPUT#file%,values% _
DIM a(values%) \
FOR loop%=1 TO values% > or a$ if using strings
INPUT#file%,a(loop%) _/
NEXT loop%
REM close file
When the data options have been selected the file can be saved in the
normal way.
ESTIMATED SIZE OF OUTPUT FILE
---------------------------------------------------------------------------
Each save window has an icon which shows the maximum size which the file
will be when created. This is updated when any options are altered.
RANDOM NUMBER TABLES
---------------------------------------------------------------------------
Clicking on 'Number tables...' in the main window will bring up a new
window which is used to create random number tables. These are tables of
random digits which can be use in statistics. The table is made up of
a number of ROWS of digits, each consisting of GROUPS of a certain WIDTH.
These three parameters may be altered in the window by using the arrows
or entering the values directly into the icon.
HISTORY
---------------------------------------------------------------------------
1.00 (14 Jun 1995) : • The first version, fully working. Output as text,
data or CSV. Integers and 1-9 dp supported.
---------------------------------------------------------------------------
1.01 (06 Aug 1995) : • Moved filetype-specific options into separate save
box for each output type
• Added routine to create random number tables
• Added options to show numbers during creation
• Removed 'line terminator' option from text output
THINGS TO DO
---------------------------------------------------------------------------
• Add accuracy option for significant figures as well as decimal places
• Add 'test' routine which will take a large sample of numbers and compare
the mean with the expected value. This should show up any errors in my
random number generator!
LEGAL BIT
---------------------------------------------------------------------------
This program is Freeware, NOT public domain. This means that I retain the
copyright but give everyone the right to distribute it by any means,
anywhere, as long as all files are supplied and I am fully credited.
Although this program has been fully tested, I (the author) cannot be held
responsible for any loss or damage caused by the use or misuse of this
program. It is used entirely at your own risk.
CONTACT
---------------------------------------------------------------------------
Please feel free to write to me at the address below. Let me know if you
can think of any ways to improve the program, or if you find any bugs. Any
donations will be greatly appreciated, and you can obtain the latest
versions of all my programs by sending either:
a) A cheque for £1.00
or b) A disc, a first class stamp and a suitable method of returning your
disc. (If you send me the disc in a Jiffy bag then I can re-use it to
send the disc back).
Currently (13/8/1995) my other programs are as follows:
- DirOpen 1.01 (04 Feb 1995) : Drag directories and apps to icon bar to
open them. Reopen last dir from icon bar
- DiscComp 1.07 (03 Jun