SA-MP Forums Random numbers
 New Account Members List Search Today's Posts Mark Forums Read

 03/08/2019, 02:53 PM #1 Manuel78 Little Clucker   Join Date: Jul 2017 Posts: 8 Reputation: 0 Random numbers Are random numbers in pawno really random? I read somewhere on this forum that pawno has congruential pseudo-random number generator with a range and a period of 231. So can someone explain how does it actually work? I'm fascinated with things like that and I can't find meaningfull results on ******.
 03/08/2019, 04:47 PM #2 dugi Beta Tester   Join Date: Jun 2007 Location: Poland Posts: 2,347 Reputation: 854 Re: Random numbers https://github.com/pawn-lang/compile.../pawn-lang.pdf check page 126 Random number generators in programming languages are pseudo-random it's the same in case of Pawn(not Pawno which is the editor). https://www.cs.utah.edu/~germain/PPS...m_numbers.html
 03/08/2019, 05:46 PM #3 Manuel78 Little Clucker   Join Date: Jul 2017 Posts: 8 Reputation: 0 Re: Random numbers So based on this it's not random, now my question is can you guess a sequence of numbers somehow if you know how random() function looks like?
 03/08/2019, 07:42 PM #4 Freaksken Gangsta     Join Date: Mar 2009 Location: Belgium Posts: 507 Reputation: 368 Re: Random numbers Random number generators often work with a seed, which is a number that is used in the calculation to provide the random numbers. When the same seed is given, you will get the exact same sequence of random numbers. In most languages, you can manually set that seed. Pawn however, doesn't seem to have a way of explicitely setting the seed, so most likely the system's clock time is used implicitely. __________________ Always keep in mind that a lot of people are active on this forum in their spare time. They are sacrificing time they could easily spend on things they would rather do, to help you instead. [Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like co-op mission - [Other] List of all my work
 03/08/2019, 08:43 PM #5 Manuel78 Little Clucker   Join Date: Jul 2017 Posts: 8 Reputation: 0 Re: Random numbers So players shouldn't be able to predict numbers in lotto for example. Ok
16/08/2019, 05:29 PM   #6
CheezIt
Big Clucker

Join Date: Apr 2017
Posts: 178
Reputation: 17
Re: Random numbers

Quote:
 Originally Posted by Manuel78 So players shouldn't be able to predict numbers in lotto for example. Ok
Most likely, not
__________________
I'd like to bring back my old CNR server that was created from scratch & hosted years ago. I'll host & update everything (including the website & forum). You would pay for hosted tab and help manage the community. PM me if you're interested!

 31/08/2019, 06:51 AM #7 GTLS High-roller     Join Date: Aug 2014 Location: India Posts: 1,072 Reputation: 118 Re: Random numbers The current random number logic is BY FAR the most accurate than in the past. Although, you can create your own algorithm using your formula to try to create a better random generator but the odds are you will end up with more predictable algorithm. https://en.wikipedia.org/wiki/Pseudo...mber_generator - Read here current PRNG method is really good. You can test it easily. You can Generate 200-300 or more values using any algorithm, and divide the numbers's range into half. (For eg, if you created random numbers between 0 to 1, use 0.5 as mid point). Now, count how many random numbers are generated less than 0.5 and more than 0.5. If they are close to 50%, it means algorithm is almost perfect. __________________ I don't help for rep. I help cuz I was helped in the past. Retired from SAMP Scene. Might open SAMP Forums once in a while. Some treats for ya. Click em Basic House System Simple Speedo Base Login/Register Script

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Zloto Scripting Help 3 05/05/2015 09:36 PM RedCode Scripting Help 7 15/03/2015 11:57 PM ZBits Scripting Help 3 17/01/2014 02:43 AM Zex Tan Scripting Help 6 19/01/2013 12:54 AM Jimbo01 Help Archive 2 01/02/2011 07:45 PM

All times are GMT. The time now is 10:16 AM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top