473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Random number generation

24
hi
i want to generate random numbers between 1 to 100......its more like a game..i'll explain it..now u have to think of a number..then when you click the button it should ask yes/no questions like whether the number is between 1 to 100...i need a code for this in asp.net and c#.. please someone help me.

thank you
Aug 31 '07 #1
4 1067
Shashi Sadasivan
1,435 Expert 1GB
hi
i want to generate random numbers between 1 to 100......its more like a game..i'll explain it..now u have to think of a number..then when you click the button it should ask yes/no questions like whether the number is between 1 to 100...i need a code for this in asp.net and c#.. please someone help me.

thank you
If you search online (google or something) you will find what you need.
I got what you want in c#

Expand|Select|Wrap|Line Numbers
  1. private int RandomNumber(int min, int max)
  2. {
  3. Random random = new Random();
  4. return random.Next(min, max); 
  5. }
Now what do you want with ASP .Net? ... is that a mystery like this one too?
Aug 31 '07 #2
doll
24
If you search online (google or something) you will find what you need.
I got what you want in c#

Expand|Select|Wrap|Line Numbers
  1. private int RandomNumber(int min, int max)
  2. {
  3. Random random = new Random();
  4. return random.Next(min, max); 
  5. }
Now what do you want with ASP .Net? ... is that a mystery like this one too?

hi
thank you... but wat tools to use for the form page..is it enough if i use a button..the code is running but output is not displayed..what should i do..please tell me
Aug 31 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
could you attach or send a sample project of what you have done / want
Aug 31 '07 #4
Plater
7,872 Expert 4TB
hi
thank you... but wat tools to use for the form page..is it enough if i use a button..the code is running but output is not displayed..what should i do..please tell me
Your question should be how to display data on an aspnet page then, not how to generate random numbers.


For a quick use, stick an asplabel on your page and give it a unique id.
The in code you can say
Expand|Select|Wrap|Line Numbers
  1. myrandomnumlabel.Text="This is my random number"+rannum.ToString();
  2.  
Aug 31 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Ioannis Vranos | last post by:
I want to create some random numbers for encryption purposes, and i wonder if the following scheme makes it more hard to guess the underneath number generation pattern, than the plain use of...
22
by: gagan.singh.arora | last post by:
Hi there. I want to generate random numbers with a given probability, say 80% even and 20% odd. Is it possible to implement such an algorithm in C?
21
by: chico_yallin | last post by:
I just wana make a random id number based on4 digits-for examples?? Thanks in Advance Ch.Yallin
16
by: jason.cipriani | last post by:
I am looking for a random number generator implementation with the following requirements: - Thread-safe, re-entrant. - Produces consistently reproducible sequences of psuedo-random numbers...
14
by: jason.cipriani | last post by:
I am looking for a random number generator implementation with the following requirements: - Thread-safe, re-entrant. - Produces consistently reproducible sequences of psuedo-random numbers...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.