Math.random returns the same value with the current version of Jint

30 views
Skip to first unread message

George Kinsman

unread,
Feb 2, 2016, 11:00:42 PM2/2/16
to RavenDB - 2nd generation document database
Hi,

I found this thread regarding Math.random returning the same value for subsequent calls: https://groups.google.com/forum/#!searchin/ravendb/math.random/ravendb/79lDNJ-8nMY/oNc9XeGJBAAJ

I found this issue with Math.random() int Jint 2.4.0 which was fixed in 2.4.1 with this commit: https://github.com/mediaclip/jint/commit/a74013b5e66fecd01df1d483823b8766a892db7a.

RavenDB still uses 2.4.0, which explains why it doesn't work. Unfortunately it appears that the SharedLibs have been ilmerged, so I can't verify the problem by replacing the dll.

I've tried several other pseudo-rng libraries, but it appears that Jint is unable to parse them - has anyone had any success including them in a ScripedPatchRequest?

Cheers,
George

Oren Eini (Ayende Rahien)

unread,
Feb 3, 2016, 4:48:30 AM2/3/16
to ravendb

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oren Eini (Ayende Rahien)

unread,
Feb 3, 2016, 4:55:19 AM2/3/16
to ravendb
In the meantime, use:


var seed = 1234;
function random() {
  seed ^= (seed << 21);
  seed ^= (seed >>> 35);
  seed ^= (seed << 4);
  return seed;
}

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Wed, Feb 3, 2016 at 5:37 AM, George Kinsman <geo...@georgekinsman.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages