Problem !!!

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu