LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 11:41 AM   #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, 11:49 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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, 11:53 AM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

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

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

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Int(100*Rnd)
 
Old 04-10-2012, 12: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, 12:46 PM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,011

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194
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, 01: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 01:24 PM.
 
  


Reply



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 08:21 PM
LXer: Popular Board Game Memoir '44 Comes to Linux as an Online Computer Game LXer Syndicated Linux News 0 07-13-2011 03:30 AM
LXer: Game Editor to create your game, on Linux LXer Syndicated Linux News 0 07-12-2011 09:10 PM
will you play windows game or linux native game pleasehelpme Linux - Newbie 16 04-29-2007 08:58 PM
LXer: Open-source software gives varsity e-learning edge LXer Syndicated Linux News 0 09-05-2006 04:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 AM.

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
Open Source Consulting | Domain Registration