Developers Archive

List Statistics

  • Total Threads: 675
  • Total Posts: 2049

Phrases Used to Find This Thread

  #1  
03-03-2011 04:33 PM
Developers member admin is online now
User
 

https://github.com/arduino/Arduino/blob/master/hardware/arduino/cores/arduino/WMath.cpp#L51

It should be nice the random (long howsmall, long howbig) function to be
implemented in such a way that is indepedent from the random (howbig)..

These two functions have consistency and could be nice to be indepedent..

So, I suggest the following function for break the consistency...

It's a matter of software engineering... because changes to one function may
lead us changes to the other.

long random(long howsmall, long howbig) {
if (howsmall >= howbig)
return howsmall;

return howsmall + (random() % (howbig - howsmall + 1));
}

It's better both functions to depend on standard simple random() only...

Waiting for your opinion...

Happy Hacking!

--
Efstathios Xatzikiriakidis (Lafs).
Informatics & Communications Engineer BSc.

Website: http://www.efxa.org/

-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS d- s+: a- C UL P+ L+++ E+ W+++ N++ o K- w- O-
M V- PS PE- Y PGP+ t 5 X R !tv b++ DI- D G e+ h* r+++
-END GEEK CODE BLOCK-







NewsArc Lists  |  Culture Pages   |  Computing Archive  |  Media-Pages
Link to this page on your blog or website by copying the HTML code below and pasting it into your site: