![]() |
|
[C] Accendentaly made program that prints random numbers without rand() - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] Accendentaly made program that prints random numbers without rand() (/showthread.php?tid=5918326) |
Accendentaly made program that prints random numbers without rand() - F.A.S.T - Dec 12, 2018 a.out returns something else everytime. PHP Code RE: Accendentaly made program that prints random numbers without rand() - RascalPascal - Dec 12, 2018 (Dec 12, 2018 11:57 AM)F.A.S.T Wrote: a.out returns something else everytime. You are just casting random pointers to int. Nothing special and not worth making a thread about it. RE: Accendentaly made program that prints random numbers without rand() - wit - Dec 12, 2018 using namespace std; ^ use this more often RE: Accendentaly made program that prints random numbers without rand() - RascalPascal - Dec 12, 2018 (Dec 12, 2018 12:16 PM)Hyphonix Wrote: using namespace std; Dont use that more often. Its a bad practice. Its fine for smaller projects but keep in mind that the std namespace has tons of identifiers, many of which are very common ones (think list, sort, string, iterator, etc.) which are very likely to appear in other code, too. RE: Accendentaly made program that prints random numbers without rand() - wit - Dec 12, 2018 (Dec 12, 2018 12:34 PM)RascalPascal Wrote: Dont use that more often. Its a bad practice. Its fine for smaller projects but keep in mind that the std namespace has tons of identifiers, many of which are very common ones (think list, sort, string, iterator, etc.) which are very likely to appear in other code, too. The OP's code looks like something from a school assignment, in that case std is fine to use 99% of the time. RE: Accendentaly made program that prints random numbers without rand() - aetherhf - Dec 13, 2018 I tried this just now. PHP Code Output: Code 00000000002F7470:3110000Ahh yes, there is a VIRTUAL MEMORY !! RE: Accendentaly made program that prints random numbers without rand() - incognito04 - Dec 13, 2018 That's just ASLR in action. RE: Accendentaly made program that prints random numbers without rand() - F.A.S.T - Dec 15, 2018 (Dec 12, 2018 12:42 PM)Hyphonix Wrote: The OP's code looks like something from a school assignment, in that case std is fine to use 99% of the time. No it's just experiments. NO School assignment. Anyway, I just wanted to know why that was happening. Thanks alot people. RE: Accendentaly made program that prints random numbers without rand() - incognito04 - Dec 15, 2018 (Dec 15, 2018 08:35 AM)F.A.S.T Wrote: No it's just experiments. NO School assignment. Your welcome dude. RE: Accendentaly made program that prints random numbers without rand() - Sajuuk - Dec 18, 2018 (Dec 12, 2018 12:42 PM)Hyphonix Wrote: The OP's code looks like something from a school assignment, in that case std is fine to use 99% of the time. Still, better to avoid bad practice for future sake than ignore what might be ahead and do it anyway. Maybe that philosophy is a bit much for simple stuff such as a statement for namespace usage, but it can tie in with anything and does with everything lol. It actually makes me feel a bit better because I can see I'm not the only one specifying separate namespaces even on small tinkering projects like this. |