1. Newbie: Hello, and my first program

Hello, all!

I'm new..new to Euphoria, and new to the list.  Thought I should say "hi,"
just to be civil...

Anyway, I just finished my first program.  It doesn't do anything "useful,"
as it was just intended to test Euphoria's rand() function.  Anyway, it's
rather short, so I thought I would post it here so you could tell me if I'm
doing anything stupid...

The thing that looks the strangest to me is my use of the "printf"
statement for the output, but it works.  Did I do something "wrong," or is
it just my unfamiliarity with the language that makes me think it looks

As for the results: Euphoria consistently produces a nice balanced spread
of numbers, except the number 8 is *always* under-represented...  weird...
    snowgen at wf.net

--------begin program

-- Test of randomness

--Just a little program to test the randomness of Euphoria's "rand()"
--Generates one million random numbers between one and ten
--and outputs the distribution
-- usage: ex random

--without type_check --unrem for speed

sequence TALLY
integer TEMP


for l=1 to 1000000 do
  position(1,1)  --just to let the user know the program is running
  print(1, l)  --biggest bottle-neck of the program  :(
end for


for l=1 to 10 do
  printf(1, "%2d     %6d %s", {l, TALLY[l], "\n"})
end for

new topic     » topic index » view message » categorize


Quick Links

User menu

Not signed in.

Misc Menu