1. Problem !!!
- Posted by "Lucius L. Hilley III" <luciuslhilleyiii at JUNO.COM> Feb 21, 1997
- 1056 views
Dear Robert. I have a serious problem. I will for the mean time work AROUND it. The problem is that I have a piece of code that calls for the random generator 256,000 times. The Piece of code is below and as you can see by the comment that I have TRIED reseeding with different numbers BUT I keep getting a CAUSEWAY ERROR. What is the Max seed number and where you aware of this Problem? I am attempting to create a sort routine that requires FEWER Decisions than any other. I could Really use that random generator for testing purposes. THANKS Lucius. integer size--, sl, ssl, chk sequence unsorted, sorted, sorted2 size = 256 unsorted = repeat(0, size) for B = 1 to 1000 do --set_rand(B) for A = 1 to size do unsorted[A] = rand(256) end for position(1, 1) sorted = sort(unsorted) sorted2 = my_sort(unsorted) ? compare(sorted, sorted2) end for --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I can only support file transfers of less than 64K and in UUE format.
2. Problem !!!
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM> Feb 21, 1997
- 1038 views
Lucius L. Hilley III writes: > What is the Max seed number and where > you aware of this Problem? I'm not aware of any problem with rand() or set_rand(). The seed value for set_rand() can be *any* atom, but only the lower 32-bits are actually used. I've added a note about this to library.doc - thanks. > I am attempting to create a sort routine that > requires FEWER Decisions than any other. > I could Really use that random generator for > testing purposes. "bucket sort" requires *zero* comparisons, but you need a reasonable bound on the size of the values you are sorting. i.e. allocate a big sequence with 256 (as below) elements, and then just count the frequencies of values 1..256 as they occur. When you are done, you can step through the sequence and make a nicer list of all the values that occurred. If you're interested I can write some code for this and post it - it's fairly simple. It's an order(N) sort - the fastest possible. I ran your code below on 1.4b and 1.5 alpha -- no problem on my machine. If anyone else has a problem with it I hope they will let me know. Of course I had to comment out the line that calls "my_sort". Do you get a failure on the code below *without* my_sort? Or only when you call my_sort? -- if so you had better send me my_sort() or post it here. Thanks. > integer size--, sl, ssl, chk > sequence unsorted, sorted, sorted2 > size = 256 > unsorted = repeat(0, size) > for B = 1 to 1000 do > --set_rand(B) > for A = 1 to size do > unsorted[A] = rand(256) > end for > position(1, 1) > sorted = sort(unsorted) > sorted2 = my_sort(unsorted) > ? compare(sorted, sorted2) >end for Regards, Rob Craig Rapid Deployment Software
3. Re: Problem !!!
- Posted by "Lucius L. Hilley III" <luciuslhilleyiii at JUNO.COM> Feb 21, 1997
- 1056 views
On Fri, 21 Feb 1997 14:10:49 -0500 Robert Craig <robert_craig at COMPUSERVE.COM> writes: >Lucius L. Hilley III writes: >> What is the Max seed number and where >> you aware of this Problem? > >I'm not aware of any problem with rand() or set_rand(). >The seed value for set_rand() can be *any* atom, but only >the lower 32-bits are actually used. I've added a note >about this to library.doc - thanks. > >> I am attempting to create a sort routine that >> requires FEWER Decisions than any other. >> I could Really use that random generator for >> testing purposes. ------------------------------------------------- I can now test the sort and the random is NOT the problem. ------------------------------------------------- >"bucket sort" requires *zero* comparisons, but you need I need the comparisons so that I can reconstruct that I can map there choices and reconstruct the original order. Thanks any how. If anyone else would like to know how bucket sort works then you need to speak up. > Do you get a failure on the code below *without* >my_sort? NOPE ! It is somewhere in my_sort. >if not then you had better send me my_sort() >or post it here. Thanks. I will send it to YOU. I am trying to create compression. and I don't want the source floating about. THANKS. I haven't been able to track the Problem as of yet. I have noticed that it doesn't seem to occur unless. "size" is set above 200 BUT it might occur as low as 128. IT hasn't so far though. :-] Good luck tracking the problem. I haven't a clue. --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I can only support file transfers of less than 64K and in UUE format.
4. Re: Problem !!!
- Posted by Jacques Deschenes <desja at QUEBECTEL.COM> Feb 21, 1997
- 1016 views
- Last edited Feb 22, 1997
At 14:10 21-02-97 -0500, you wrote: >"bucket sort" requires *zero* comparisons, but you need >a reasonable bound on the size of the values you are sorting. >i.e. allocate a big sequence with 256 (as below) elements, >and then just count the frequencies of values 1..256 as they occur. >When you are done, you can step through the sequence and make a >nicer list of all the values that occurred. If you're interested >I can write some code for this and post it - it's fairly simple. >It's an order(N) sort - the fastest possible. Hi Robert, What a suprise to read that. A sort with *zero* comparisons! By nature sorting means comparing. I would certainly be happy to see that miraculous sort. Jacques Deschenes Baie-Comeau, Quebec Canada desja at quebectel.com
5. Re: Problem !!!
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM> Feb 21, 1997
- 1044 views
- Last edited Feb 22, 1997
Jacques Deschenes writes: > What a suprise to read that. A sort with *zero* comparisons! > By nature sorting means comparing. I would certainly be happy to see > that miraculous sort. -- bucket sort ------------------------------------------------------ function bucket_sort(sequence s, integer min_value, integer max_value) -- Sort s into ascending order. No elements are compared. -- The values of s must be integers from min_value to max_value sequence count, sorted integer value count = repeat(0, max_value-min_value+1) s = s - (min_value - 1) for i = 1 to length(s) do value = s[i] count[value] = count[value]+1 end for sorted = {} for i = 1 to length(count) do sorted = sorted & repeat(i, count[i]) end for return sorted + (min_value - 1) end function ? bucket_sort({25,7,2,5,200,14,7,10}, 1, 256) ------------------------------------------------- Regards, Rob Craig Rapid Deployment Software
6. Re: Problem !!!
- Posted by Jacques Deschenes <desja at QUEBECTEL.COM> Feb 22, 1997
- 1032 views
At 23:59 21-02-97 -0500, you wrote: >Jacques Deschenes writes: >> What a suprise to read that. A sort with *zero* comparisons! >> By nature sorting means comparing. I would certainly be happy to see >> that miraculous sort. > >-- bucket sort ------------------------------------------------------ > >function bucket_sort(sequence s, integer min_value, integer max_value) >-- Sort s into ascending order. No elements are compared. >-- The values of s must be integers from min_value to max_value > sequence count, sorted > integer value > > count = repeat(0, max_value-min_value+1) > s = s - (min_value - 1) > for i = 1 to length(s) do > value = s[i] > count[value] = count[value]+1 > end for > sorted = {} > for i = 1 to length(count) do > sorted = sorted & repeat(i, count[i]) > end for > return sorted + (min_value - 1) >end function > >? bucket_sort({25,7,2,5,200,14,7,10}, 1, 256) > >------------------------------------------------- Converted me Robert, Now I'm a beleiver. Alleluia! Jacques Deschenes Baie-Comeau, Quebec Canada desja at quebectel.com