Post Reply 
Mersenne Twister implentation
02-05-2017, 07:00 PM
Post: #3
RE: Mersenne Twister implentation
(02-05-2017 05:37 PM)grsbanks Wrote:  
(02-04-2017 04:19 PM)KeithB Wrote:  
Code:
{snip}
LOCAL i;
FOR i FROM 1 TO 624 DO
L9(i):=#0d;
END;
{snip}

Just wondering out loud here...

Is the above quicker than:
Code:
L9:=MAKELIST(#0d,A,1,624);

Somehow I'm guessing that the loop involved in MAKELIST, running at system level, is going to be faster than a FOR loop in user code. Also, no need for the local variable but it will clobber the 'A' home variable and anything in L9 beyond the 624th element, although the latter is a non-problem if this is an initialization function anyway.

Just curious...

Godwin Stewart (happy HP Prime owner since Wednesday)

Write 2 similar programs, each with the 2 optional styles, and time them. You may have to run this inside an outer loop for 10 (or 100, etc) times to really see the difference. Let us all know.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Mersenne Twister implentation - KeithB - 02-04-2017, 04:19 PM
RE: Mersenne Twister implentation - rprosperi - 02-05-2017 07:00 PM
RE: Mersenne Twister implentation - KeithB - 02-06-2017, 04:42 PM
RE: Mersenne Twister implentation - KeithB - 02-06-2017, 07:08 PM



User(s) browsing this thread: 1 Guest(s)