LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2012, 12:41 PM   #1
Venter
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Rep: Reputation: Disabled
Varsity game Assignment


I have been given an assignment to generate a random number between 1-99
and then let the user guess the number, can anyone help me with the random part?
Thanks
 
Old 04-10-2012, 12:49 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help.
 
Old 04-10-2012, 12:53 PM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Code:
echo $((RANDOM % 99))
 
Old 04-10-2012, 01:02 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
Would also be good to know in which language you have to do that (Bash, Python, C, ...).
 
Old 04-10-2012, 01:16 PM   #5
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,030

Rep: Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623Reputation: 1623
Int(100*Rnd)
 
Old 04-10-2012, 01:35 PM   #6
Venter
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
sorry it's bash and thank you
 
Old 04-10-2012, 01:46 PM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,256

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
Again I am genuinely surprised that teachers these days ask questions about things they do not teach. I mean why are people supposed to learn things that aren't even in the curriculum?

Sorry ... small rant
 
Old 04-16-2012, 02:22 PM   #8
Venter
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Small runt =)

They only teach us the basics and then tell us the rest is self study via books internet and so on. So its kinda hard figuring the stuff i need for my practicals and other stuff.

Last edited by Venter; 04-16-2012 at 02:24 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Game Devs Upload Their Own Game on Pirate Bay, Strangely It Increases Sales LXer Syndicated Linux News 0 09-13-2011 09:21 PM
LXer: Popular Board Game Memoir '44 Comes to Linux as an Online Computer Game LXer Syndicated Linux News 0 07-13-2011 04:30 AM
LXer: Game Editor to create your game, on Linux LXer Syndicated Linux News 0 07-12-2011 10:10 PM
will you play windows game or linux native game pleasehelpme Linux - Newbie 16 04-29-2007 09:58 PM
LXer: Open-source software gives varsity e-learning edge LXer Syndicated Linux News 0 09-05-2006 05:33 AM


All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration