Newbie: Hello, and my first program
- Posted by Snowgen <snowgen at WF.NET> Nov 24, 1996
- 1791 views
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 weird? As for the results: Euphoria consistently produces a nice balanced spread of numbers, except the number 8 is *always* under-represented... weird... __ Snowgen snowgen at wf.net http://www.wf.net/~snowgen/ --------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 TALLY={0,0,0,0,0,0,0,0,0,0} clear_screen() for l=1 to 1000000 do TEMP=rand(10) TALLY[TEMP]=TALLY[TEMP]+1 position(1,1) --just to let the user know the program is running print(1, l) --biggest bottle-neck of the program :( end for clear_screen() for l=1 to 10 do printf(1, "%2d %6d %s", {l, TALLY[l], "\n"}) end for