+ 3

Code Challenge - Random

This is a unique challenge! In this you have to make your own random() function in Java, C++, C# or JavaScript! This function by-default should generate numbers between 0-10. #CodeItOff! https://code.sololearn.com/cglNhhybKHiI/?ref=app

2nd Jul 2017, 3:41 AM
Bruh
13 Answers
+ 9
https://code.sololearn.com/cMUCJqFL1X65/?ref=app
2nd Jul 2017, 4:27 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
Ok I understand what you mean. :D
2nd Jul 2017, 9:46 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
It has flaws btw. I have added a note in the code comments to specify its 'educational use only' claim. :>
2nd Jul 2017, 5:14 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
I met with the even number issue with this code too, then did a little tweak. I suppose it is random enough? https://code.sololearn.com/cbJDCXAlR5EX/?ref=app
2nd Jul 2017, 9:39 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
@Hasty Well Done!
2nd Jul 2017, 4:28 AM
Bruh
+ 3
@cheeze It will never generate good randomness
2nd Jul 2017, 5:53 AM
Bruh
+ 2
am using time for rng lol random = () => new Date().getMilliseconds() % 10 this will generate random numbers from 0 inclusive to 10 exclusive
2nd Jul 2017, 5:52 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
yeah tru, they kept giving me even numbers ill work on it if i reach home EDIT: i came up with this which is surprisingly more random random = () => ~~(new Date().getMilliseconds() / 100)
2nd Jul 2017, 7:00 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
@ I know it's C++ But Pointers aren't available in Java
2nd Jul 2017, 9:46 AM
Bruh
+ 1
I think you might understood it now
2nd Jul 2017, 9:47 AM
Bruh
+ 1
Ow, It's Hatsy. I just Noticed it, Sorry for saying You Hasty and Hasty Again and again
2nd Jul 2017, 9:48 AM
Bruh
0
@Hasty Thai code can't be used in all the languages I mentioned. The Code must be one that can be used in all of the above mentioned languages. By the way Nice Try! https://code.sololearn.com/cbJDCXAlR5EX/?ref=app
2nd Jul 2017, 9:44 AM
Bruh
0
@Hatsy See My Work : : Inspired from Your's https://code.sololearn.com/cglNhhybKHiI/?ref=app
2nd Jul 2017, 3:51 PM
Bruh