• 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: Arthur J Knapp <email@hidden>
  • Date: Mon, 01 Apr 2002 10:48:55 -0500

> Date: Sun, 31 Mar 2002 09:08:43 +0200
> From: Emmanuel <email@hidden>
> Subject: Re: Random Numbers fasters than the osax

> 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. :)

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. ;-)


> (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.


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
<mailto:email@hidden>
try
<http://members.bellatlantic.net/~bswaldie/>
on error number -128
end try
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: Random Numbers fasters than the osax
      • From: email@hidden (Michael Sullivan)
  • Prev by Date: batch inport to FMP
  • Next by Date: How to get a folder's file list sorted by date in OSX?
  • Previous by thread: Re: Random Numbers fasters than the osax
  • Next by thread: Re: Random Numbers fasters than the osax
  • Index(es):
    • Date
    • Thread