<< OK, I have a working trivial plugin for this that just does a 30bit int for now. >>
I do not understand what is different about working with 30 bit integers as opposed to the 32 bit version I started with?
<< Seems to work ok - making a bag of 1000 values suggests it at least does a tolerable job. Though it does bother me a bit that in a whole load of tests I've not seen any number with less than a half-dozen digits. I'll let you numerics fanatics worry about that part. >>
You mean that all of the sample numbers have at least six decimal digits?
<< So what sorts of values would be useful? Is just a 30bit int ok with any further cleverness being done in the image? >>
I am not sure if the desirable properties of the Mersenne Twister are preserved if we drop down from 32 bit words. I was hoping to duplicate the algorithm exactly. (Note I said "I", not "you" !) For casual use, it may not be any better or worse than the current generator. For serious use, though, it should reproduce the C program. If it does not, then one suspects that other properties are lost, too.
-Mark
Mark4Flies@aol.com is claimed by the authorities to have written:
<< OK, I have a working trivial plugin for this that just does a 30bit int for now. >>
I do not understand what is different about working with 30 bit integers as opposed to the 32 bit version I started with?
It's a detail Smalltalk thing - SmallIntegers are 30bits with 1 sign bit (plus the hidden tag bit) and so restricting the values generated to 30bits guarantees a simple life and still gives a billion or so +ve values. Since the C code has a 31bit routine that uses the 32bit and merely shifts right one, I assume that shifting right 2 will be ok. I could be wrong; it has happened before.
<< Seems to work ok - making a bag of 1000 values suggests it at least does a tolerable job. Though it does bother me a bit that in a whole load of tests I've not seen any number with less than a half-dozen digits. I'll let you numerics fanatics worry about that part. >>
You mean that all of the sample numbers have at least six decimal digits?
Yup. As Ian P pointed out yesterday, one would expect only one in 1000 numbers to be less than a million when using 30bit values. I did a much larger test and it looks reasonable to my eyes. It ought to be run through some tester or other.
<< So what sorts of values would be useful? Is just a 30bit int ok with any further cleverness being done in the image? >>
I am not sure if the desirable properties of the Mersenne Twister are preserved if we drop down from 32 bit words. I was hoping to duplicate the algorithm exactly. (Note I said "I", not "you" !) For casual use, it may not be any better or worse than the current generator. For serious use, though, it should reproduce the C program. If it does not, then one suspects that other properties are lost, too.
One of the little joys of using a vm plugin for replicating C code like this (with all those bit twiddles) is that you simply steal the C and use it :-) Whihc neatly sidesteps the problems you've been having....
tim
Tim Rowledge wrote: <snipped>
One of the little joys of using a vm plugin for replicating C code like this (with all those bit twiddles) is that you simply steal the C and use it :-) Whihc neatly sidesteps the problems you've been having....
It depends: if you generate the plugin by using Slang, you have to do (think) more.
I think you mean using the C stuff as it is and calling it by some generated Slang function.
Greetings,
Stephan
tim
Stephan Rudlof sr@evolgo.de is claimed by the authorities to have written:
Tim Rowledge wrote:
<snipped>
One of the little joys of using a vm plugin for replicating C code like this (with all those bit twiddles) is that you simply steal the C and use it :-) Whihc neatly sidesteps the problems you've been having....
It depends: if you generate the plugin by using Slang, you have to do (think) more.
I think you mean using the C stuff as it is and calling it by some generated Slang function.
Exactly. You can steal the original code and trivially make a connection to it. About the only tricky part is deleting the original 'main()' function.
tim
squeak-dev@lists.squeakfoundation.org