Re: how good is .NET's Random for making random numbers?
- From: "Jon Davis" <jon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 15 May 2007 23:46:00 -0700
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message news:MPG.20b4b60440ccff79107@xxxxxxxxxxxxxxxxxxxxxxx
Jon Davis <jon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:I always create a exactly one single static Random object with my app and
seed it with DateTime.Now.Ticks.
Random already seeds itself with Environment.TickCount if you don't
provide any constructor parameters.
True, but specifying the ticks gives me a stub I can modify later.
You need to watch for using a single object in a multi-threaded
situation though - Random isn't thread-safe.
Since Next() always scrambles its seed, regardless of calling thread, why is this of concern?
Jon
.
- Follow-Ups:
- Re: how good is .NET's Random for making random numbers?
- From: Jon Skeet [C# MVP]
- Re: how good is .NET's Random for making random numbers?
- From: Jon Davis
- Re: how good is .NET's Random for making random numbers?
- References:
- how good is .NET's Random for making random numbers?
- From: Zytan
- Re: how good is .NET's Random for making random numbers?
- From: Jon Davis
- Re: how good is .NET's Random for making random numbers?
- From: Jon Skeet [C# MVP]
- how good is .NET's Random for making random numbers?
- Prev by Date: PHP and C#
- Next by Date: Re: SQL Server 2005 Express Edition login problem when deploying a windows application
- Previous by thread: Re: how good is .NET's Random for making random numbers?
- Next by thread: Re: how good is .NET's Random for making random numbers?
- Index(es):
Relevant Pages
|