• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Random Numbers fasters than the osax
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random Numbers fasters than the osax


  • Subject: Re: Random Numbers fasters than the osax
  • From: email@hidden (Michael Sullivan)
  • Date: Mon, 1 Apr 2002 16:42:35 -0500
  • Organization: Society for the Incurably Pompous

Arthur J Knapp writes:
> > From: Emmanuel <email@hidden>
> > At 1:21 AM +0200 30/3/02, Arthur J Knapp wrote:
> >>
> >> I would really appreciate it if someone could point me in the
> >> direction of some simple pseudo code for RNGs, (as opposed to
> >> platform-optimized implementations or complex mathematical theses).

> > I'm surely missing something, but what's wrong with the suggestion I
> > presented 3 days ago?

> >> set theNextRandomNumber to (thePreviousOne + BigBigPrime) mod (BigPrime)
>
> >> where BigPrime is any big prime number, and BigBigPrime a still bigger one.

> Nothing is wrong with this, Emmanual, it's great. :)

Actually, it's problematic for reasons I've brought up in another post.
Well, it's usable if a *very* dirty sequence is acceptable, which is
probably true a lot of the time.

> I am just aware that there are many different algorithms for generating
> random numbers, and yet it is difficult to find simple resources for
> these techniques that do not require a doctorate in calculus. ;-)

Number Theory is what you're looking for, actually.

> > (if you're looking for integer random numbers, then BigPrime must be
> > something like your range of values - not a prime number then)

> Right, any range can be found with this type of formula:

> (R mod M) + N

> where R is a random number, M is the upper bounds, and N is the lower
> bounds.

I think you mean:

(R mod (M - N + 1)) + N


Michael

--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Random Numbers fasters than the osax (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: Re: Random Numbers fasters than the osax
  • Next by Date: Re: Random Numbers fasters than the osax
  • Previous by thread: Re: Random Numbers fasters than the osax
  • Next by thread: Re: Random Numbers fasters than the osax
  • Index(es):
    • Date
    • Thread