Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,735 members, 7,955,792 topics. Date: Sunday, 22 September 2024 at 03:14 PM |
Nairaland Forum / Science/Technology / Programming / Try This,programmers (357 Views)
I'm Leaving Nairaland But Not Without A Gift For ALL Programmers! / See Money Making Programmers In Nairalans / Benefits Of The Improvements Made On Forum4africa - Programmers (2) (3) (4)
Try This,programmers by NDSMELODY(m): 2:21pm On Jul 31, 2021 |
Write a program that would roll a dice using any programming language |
Re: Try This,programmers by Karleb(m): 6:58pm On Jul 31, 2021 |
Store 1 to 6 in an array and shuffle it. Pop out any index then repeat. let numbers = [1, 2, 3, 4, 5, 6]; function shuffle(numbers) { return numbers.sort(() => Math.random() - 0.5); } alert(shuffle(numbers).pop()); I had a little help. |
Re: Try This,programmers by NDSMELODY(m): 8:53pm On Jul 31, 2021 |
Karleb:I guess you used python pl,but for I used java pl
|
Re: Try This,programmers by spartan117(m): 11:14pm On Jul 31, 2021 |
JavaScript const randomNumber = () => Math.floor(Math.random()*6 +1) |
(1) (Reply)
Jeff Bezos Funds Anti-ageing Technology To Help Humans ‘live Forever’ / Code In Your Browser / Easy To Use Recharge Card Printing Software For Windows
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8 |