Ramdom

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Kevin
Posts: 74
Joined: Fri Oct 02, 2009 3:47 pm

Ramdom

Post by Kevin »

I am passing a unsigned 64 bit integer as the upper limit to random and receiving "(random: error in source expression), char 4"

put random(18446744073709551615) into _random

What is the max random can take?
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark »

Hi Kevin,

The max value for an argument of the random function is 2^32-1. Don't ask me why, this was a choice made by RunRev.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith »

I think it's simply that for some functions like random(), baseconvert() and the bitwise operators, the engine converts values to 4 byte unsigned integers.

Best,

Mark Smith
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark »

And why doe the engine convert values to 4 byte unsigned integers, Mark? ;-)

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith »

I could tell you, but then I'd have to kill you :)

Efficiency, maybe?
Post Reply