![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does Solaris have a random number generator? | one_ring99 | SUN Solaris | 3 | 04-10-2008 01:39 AM |
| generate random number in perl | zx1106 | Shell Programming and Scripting | 2 | 03-17-2008 08:13 PM |
| Random number generation in ksh | mervin2006 | UNIX for Dummies Questions & Answers | 2 | 04-26-2007 11:02 PM |
| Random number generation | tej.buch | High Level Programming | 1 | 02-13-2006 06:07 AM |
| How to generate a random number? | MacMonster | High Level Programming | 2 | 10-15-2001 09:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
random number logic -- issue
I use standard C random number generation logic in my application.
------------------------------------------------- long nCounter; long lRndNo; char rand[11]; srand48(nCounter); lRndNo = lrand48(); sprintf(rand,"%010.10d",lRndNo); -------------------------------------------------- However we always find that the rand generated starts with '0','1' or '2'. I could not logically prove if is guaranteed to start with these. We are designing a new program with the assumption that it will not start with '5'. Can someone please explain how this logic (linear conguential) works to start with '0','1','2'? I will highly appreciate. Thanks Asutosh |
| Forum Sponsor | ||
|
|