Re: Get Random number?
Re: Get Random number?
- Subject: Re: Get Random number?
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 14 Aug 2007 17:52:21 -0400
Sorry, my answer was incomplete.
> set randomNumber to do shell script "echo $RANDOM";
That gets you randomNumber as a string, which isn't that useful.
set randomNumber to do shell script "echo $RANDOM" as integer;
will get you a numeric value you can then manipulate in the ways I listed.
> which will get you a random integer uniformly distributed between 0
> and 32767, inclusive. You can then take the remainder with respect to
> some integer (if you're looking to simulate a dice roll or similar) or
> divide by 32768 to get a float in the [0,1) range.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden