[REBOL] Re: random implementation

2001-02-09 Thread Chris

George Bashilov wrote:

 By the way, you could use a truly random nondeterministic
 number generator from Intel,
 called Intel RNG and implemented in all of its modern
 chipsets: i810, 1815, 820, 840, and so on...
 More information is available at
 http://sourceforge.net/projects/gkernel/
 and in Intel 82802 Firmware Hub: Random Number Generator
 Programmer's Reference Manual
 December 1999 Order Number: 298029-001 R
 But I don't know if it's possible to access it from Rebol ;-)

I'd be surprised ;) The other problem is that it would
restrict any script that used it to intel chipset systems
- not exactly in fitting with the Rebol ethos. 

Chris
--
New sig in the works
Explorer2260 Designer and Coder
http://www.starforge.co.uk
--
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-08 Thread Chris

Allen Kamp wrote:

  to put it another way, someone hasn't just looked at the incredibly dire
  ANSI C rand() implementation and copied it have they? (Please say no...)
 
  I believe it's based on the function you suggest. Sorry.
 
 But there is also random/secure. (Depends on the version of rebol you are
 using).

I haven't run any tests on that yet but what are the differences between 
normal and /secure? And how is the range restriction implemented? For
example, doing something like

outvalue = 1 + (calculatedRandom % maxValue)

is less random than

outvalue = 1 + ((calculatedValue * maxValue) / (maximumRandom + 1))

as LCGs have less random lower order bits. 

I want to use the random command as part of a Beauford PSC so the
sequential
correlation on successive calls need to be as low as possible. The
standard
ANSI example implementation is fairly poor (although not disasterously
so)
for this and unless the increment, multiplier and modulus are chosen
very carefully the generator is almost useless. I may try to implement 
a subtracitve method number generator (see Knuth D.E 1981, Seminumerical 
Algorithms 2nd Ed, vol 2 of the Art of Computer Programming) as that
should
not suffer from the correlation problem

Chris
--
New sig in the works
Explorer2260 Designer and Coder
http://www.starforge.co.uk
--
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-08 Thread Robbo1Mark

Regards Random implementation algorithms is it surely not possible we could generate a 
better "RANDOM" number sequence using a different algorithm in REBOL as a mezzainine 
function at least till RT decide to *fix* things.

If anybody on this list has a good knowledge of RANDOM algorithms, please send them to 
me and I'll knock something up as I've had problems with this recently too.

Iam also looking for a better way to generate RANDOM for inclusion in OSCAR: :REBOL 
the coming open source REBOL.

cheers,

Mark Dickson
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-08 Thread Chris

[EMAIL PROTECTED] wrote:

 "RANDOM" number sequence using a different algorithm 
 in REBOL as a mezzainine function at least till RT 
 decide to *fix* things.

RT aren't really to blame: random number generation
is an arcane art that a lot of books and courses
tend to cover badly. Very few people realise that the
algorithm suggested by ANSI is flawed simply because
it's the standard - it must be safe. They implemnt 
it or a variation of it because it's easily available,
widely used and seldom criticised outside scientific
software circles. 

 If anybody on this list has a good knowledge of RANDOM 
 algorithms, please send them to me and I'll knock 
 something up as I've had problems with this recently too.

I wouldn't say I'm an expert, but I have quite a lot
of experience in writing them. If you want a good
introduction, Numerical Recipies in C has a good
chapter on random number generation. I will probably
implement a subtractive method generator tonight
and post the code to the list anyway...

Chris
--
New sig in the works
Explorer2260 Designer and Coder
http://www.starforge.co.uk
--
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-08 Thread GS Jones

I know "zip" about random number generators, but I just happened to run
across this site (was it a "random" coincidence???  :-).  It may or may not
be of help.

http://random.mat.sbg.ac.at/generators/

--Cheers

 Robbo1Mark wrote:

  "RANDOM" number sequence using a different algorithm
  in REBOL as a mezzainine function at least till RT
  decide to *fix* things.

 RT aren't really to blame: random number generation
 is an arcane art that a lot of books and courses
 tend to cover badly. Very few people realise that the
 algorithm suggested by ANSI is flawed simply because
 it's the standard - it must be safe. They implemnt
 it or a variation of it because it's easily available,
 widely used and seldom criticised outside scientific
 software circles.

  If anybody on this list has a good knowledge of RANDOM
  algorithms, please send them to me and I'll knock
  something up as I've had problems with this recently too.

 I wouldn't say I'm an expert, but I have quite a lot
 of experience in writing them. If you want a good
 introduction, Numerical Recipies in C has a good
 chapter on random number generation. I will probably
 implement a subtractive method generator tonight
 and post the code to the list anyway...

 Chris


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-08 Thread Holger Kruse

On Thu, Feb 08, 2001 at 10:51:15AM +, Chris wrote:
 Allen Kamp wrote:
 
 I haven't run any tests on that yet but what are the differences between 
 normal and /secure? And how is the range restriction implemented? For
 example, doing something like

The default algorithm is fast, but probably not suitable for your purposes.

 outvalue = 1 + (calculatedRandom % maxValue)
 
 is less random than
 
 outvalue = 1 + ((calculatedValue * maxValue) / (maximumRandom + 1))

random/secure uses SHA1 as the iterator function. It is not an LCG, and
provides cryptographically strong non-linearity between all bits and
bit combinations, so it should not suffer from the problem you described
above.

-- 
Holger Kruse
[EMAIL PROTECTED]

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.




[REBOL] Re: random implementation

2001-02-07 Thread Andrew Martin

 How is the random command implemented? If it is based on a linear
congruential algorithm, what are the multiplier, increment and modulus? Or
to put it another way, someone hasn't just looked at the incredibly dire
ANSI C rand() implementation and copied it have they? (Please say no...)

I believe it's based on the function you suggest. Sorry.

Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
--


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.