REBOL3 tracker
  0.9.12 beta
Ticket #0000879 User: anonymous

Project:



rss
TypeIssue Statuscomplete Date2-Jun-2009 08:20
Versionalpha 55 Categoryn/a Submitted byLadislav
PlatformAll Severityminor Priorityurgent

Summary RANDOM documentation necessary
Description TomC wrote: For homework, I was asked about the random number generator in my favorite language ... did some experiments but answered "closed source" to what "algorithm does it use?" for this part, I got a zero.

So, could someone with access to rebol source or internal doc get me information on the algorithms for 'random and 'random/secure

they are probably some flavor of linear congruent generators (please don't say RANDU) but multiplicative? or mixed? maybe a PMMLCG? shuffling? QCG? MRG? What constants are used? what is the period? how many streams?
Example code
Answer: currently, there are two primary random generators:

1. old method, high speed, simple multiplicative:
	next = next * 1103515245L + 12345L;
	tmp = next & 0xffff0000;
	next = next * 1103515245L + 12345L;
	tmp |= (next >> 16);

2. much slower, SHA1() of a repeating pattern of the integer bytes (20 bytes total).

If you want others, post them (as long as BSD or MIT license).

Assigned ton/a Fixed in- Last Update20-Jun-2009 20:27


Comments
(0000892)
Ladislav
2-Jun-2009 08:22

Tom offers to examine the source, if sent to him privately to extract the implementation specifications.
(0000918)
Ladislav
9-Jun-2009 20:49

I would say, that it may be marked as complete, the description incorporated into http://www.rebol.com/r3/docs/functions/random.html

Date User Field Action Change
20-Jun-2009 20:27 Ladislav Status Modified built => complete
9-Jun-2009 20:50 Ladislav Status Modified waiting => built
9-Jun-2009 20:49 Ladislav Comment : 0000918 Added -
2-Jun-2009 19:43 carl Code Modified -
2-Jun-2009 19:43 carl Status Modified reviewed => waiting
2-Jun-2009 16:38 BrianH Status Modified submitted => reviewed
2-Jun-2009 16:38 BrianH Type Modified Bug => Issue
2-Jun-2009 08:25 Henrikmk Summary Modified Random documentation necessary => RANDOM documentation necessary
2-Jun-2009 08:23 Ladislav Description Modified -
2-Jun-2009 08:22 Ladislav Comment : 0000892 Added -
2-Jun-2009 08:20 Ladislav Ticket Added -