me trying to explain "the value of your floating point arithmetic is architecture dependent"
-
most of the time this can be ignored but considering that this was something that was seeded with a predetermined value.
rand(2.0 * 3.141592654);
is not going to return the same thing on every architecture. nor every target (i mean you get into rand() and how it's implemented...) -
i mean for the most part rand() should be pretty consistent between implementations but if you get into floating point arithmetic to that degree all bets are off actually
-
anyway i love computers
-
@puppygirlhornypost2 amber i have a question, is rand() good? like, it should be considering we have /dev/urandom, right?
-
@[email protected] depends on what you are using it for
-
@puppygirlhornypost2 can it generate cryptographically secure values?
-
@[email protected] no. not rand() as defined in stdlib.h https://en.cppreference.com/w/c/numeric/random/rand
-
@puppygirlhornypost2 so then it just... kinda sucks? because it says it has no guarantees as to the quality of the outputs
-
@[email protected] yeah it's not actually guaranteed to be the same between platforms. if i do srand(5) and then rand() there's no guarantee that running it on linux under musl and then under microsoft's libc on windows is going to give me the same result.
-
@[email protected] https://wiki.openssl.org/index.php/Random_Numbers i'd recommend using something like openssl for a cryptographically secure rng.