Timeline for Generating Even Random Numbers
Current License: CC BY-SA 3.0
33 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 19, 2014 at 22:59 | answer | added | Andrej | timeline score: 0 | |
| Jul 18, 2014 at 10:11 | answer | added | Fredszaq | timeline score: 5 | |
| Jan 17, 2014 at 16:26 | answer | added | Patrick | timeline score: 2 | |
| Jan 17, 2014 at 11:17 | comment | added | You | I suspect "multiply by 2" is the option that distorts the distribution of the random number the least, if that's important (although I can't really back that feeling up, but Math.SE would know). | |
| Jan 17, 2014 at 9:15 | comment | added | Shadur-don't-feed-the-AI | @BolucPapuccuoglu Great minds think alike. :) | |
| Jan 17, 2014 at 9:14 | comment | added | Boluc Papuccuoglu | @Shadur, beat me to it as I was writing the comment. | |
| Jan 17, 2014 at 9:14 | comment | added | Boluc Papuccuoglu | I also would recommend a left shift operation, and for completeness sake, would like to point out bitwise AND'ing with NOT(1) would work as well (in one operation). | |
| Jan 17, 2014 at 9:13 | comment | added | Shadur-don't-feed-the-AI | ... Except maybe using a bit mask to zero the least significant bit, come to think of it. | |
| Jan 17, 2014 at 9:11 | comment | added | Shadur-don't-feed-the-AI | @lohoris Because the 'add 1' operation requires you to test beforehand whether you have an odd or even number, so it's one test and one add operation, or just one test and a null; 'multiply by 2' always yields an even number, so it's always just a single operation that can be reduced to a 'bitwise left shift by 1' at assembly level. I don't think it's possible to get much faster than that... | |
| Jan 17, 2014 at 8:59 | comment | added | o0'. | @WetFeet why "multiply by 2" when you can more simply "add 1"? | |
| Jan 17, 2014 at 6:20 | comment | added | PatricK | Add 1 to the odd ones that is generated? | |
| Jan 17, 2014 at 3:46 | answer | added | Carl | timeline score: 9 | |
| Jan 17, 2014 at 2:35 | comment | added | Wet Feet | Just wondering, why not just multiply whatever number you receive from the RNG by 2? | |
| Jan 17, 2014 at 1:00 | answer | added | corsiKa | timeline score: 2 | |
| Jan 17, 2014 at 0:17 | history | reopened |
200_success James Khoury Jamal |
||
| Jan 17, 2014 at 0:03 | history | edited | rolfl | CC BY-SA 3.0 |
Restructure to bring the question back on topic for code-review.
|
| Jan 16, 2014 at 23:28 | history | closed | Jamal | Not suitable for this site | |
| Jan 16, 2014 at 21:46 | answer | added | wizzy poo | timeline score: 15 | |
| Jan 16, 2014 at 18:31 | history | edited | 200_success |
edited tags
|
|
| Jan 16, 2014 at 18:08 | vote | accept | leonideveloper | ||
| S Jan 16, 2014 at 15:01 | history | edited | konijn | CC BY-SA 3.0 |
Reword a bit for better grammar
|
| S Jan 16, 2014 at 15:01 | history | suggested | John Kugelman | CC BY-SA 3.0 |
Reword a bit for better grammar
|
| Jan 16, 2014 at 14:49 | review | Suggested edits | |||
| Jan 16, 2014 at 15:01 | |||||
| Jan 16, 2014 at 14:21 | answer | added | user3067411 | timeline score: 1 | |
| Jan 16, 2014 at 12:54 | history | tweeted | twitter.com/#!/StackCodeReview/status/423800523289264128 | ||
| Jan 16, 2014 at 10:41 | history | edited | 200_success |
edited tags; edited tags
|
|
| Jan 16, 2014 at 10:39 | answer | added | Antoine_935 | timeline score: 9 | |
| Jan 16, 2014 at 10:37 | vote | accept | leonideveloper | ||
| Jan 16, 2014 at 18:08 | |||||
| Jan 16, 2014 at 10:06 | answer | added | 200_success | timeline score: 43 | |
| Jan 16, 2014 at 7:53 | answer | added | Andris | timeline score: 22 | |
| Jan 16, 2014 at 7:52 | comment | added | ruds |
Yes, I would declare them as private static; this StackOverflow answer provides some good information.
|
|
| Jan 16, 2014 at 7:44 | history | edited | leonideveloper | CC BY-SA 3.0 |
edited tags
|
| Jan 16, 2014 at 7:34 | history | asked | leonideveloper | CC BY-SA 3.0 |