Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] rand() function

2005-05-03 by Marko Pavlin

Hello!

I found TEA very useful as random number generator.

http://www.simonshepherd.supanet.com/tea.htm

Marko


Paul Curtis wrote:
> Hi,
> 
>  > The standard rand() function of many compilers (Keil, etc.)
>  > return pseudorandom integer in range 0 to 32767.
>  > 1. Is the period of such pseudorandom generators equal to
>  > 2^15, or it is more?
> 
> Good question.  Usually these implementations are based on linear
> congruence, i.e next_random = (seed*x+y) modulo a smaller number.
> 
>  > 2. Who has an efficient algorithm for 2^31 period rand()
>  > function? Both assembler and C realizations are of interest.
> 
> Try Google, there are many PRANGs.  It really depends upon your
> application what type of PRANG to employ e.g. uniform random numbers,
> Gaussian random numbers, and so on.  Higher quality random numbers
> usually require more expensive computations and are, therefore, less
> efficient.
> 
> As with implementation of transcendental and logarithmic approximations,
> there is more than one way to skin a cat, so just consider rand() a
> low-quality function that fulfils the requirements of the ISO standard.
> 
> Boost has an appealing random number library:
> 
> http://www.boost.org/libs/random/
> 
> --
> Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors
> 
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
> 
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/lpc2000/
>        
>     * To unsubscribe from this group, send an email to:
>       lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>. 
> 
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.