473,396 Members | 1,859 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,396 software developers and data experts.

using php how do i generate random numbers?

how do i generate random no's...also i want to convert that no. to the corresponding string...using PHP!!!!!
thanks in advance..
Tarun
Sep 20 '07 #1
4 1895
code green
1,726 Expert 1GB
Use rand() then cast the number to a string (string)
Sep 20 '07 #2
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $a = rand(1,1000);
  4.  
  5. print "<p> ($a)</p>\n";
  6.  
  7. print "Click the Reload button on your browser to get a new random number.";
  8.  
  9. ?>
  10.  
hey this what i have done...
Now can you alter things in the same code and show me how to do it...i also want to print the resulting string in a image form...
Thank you in advance..
Tarun.
Sep 20 '07 #3
code green
1,726 Expert 1GB
Now can you alter things in the same code and show me how to do it
Well thank you. But I would like to see more of what you have done then I can work out what you are trying to do.
Ta.
Sep 20 '07 #4
pbmods
5,821 Expert 4TB
Heya, Tarun.

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]

Removed unnecessary '?'s from your thread title that may have made people less likely to want to look at your thread.
Sep 20 '07 #5

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

Similar topics

14
by: Anthony Liu | last post by:
I am at my wit's end. I want to generate a certain number of random numbers. This is easy, I can repeatedly do uniform(0, 1) for example. But, I want the random numbers just generated sum up...
12
by: Jim Michaels | last post by:
I need to generate 2 random numbers in rapid sequence from either PHP or mysql. I have not been able to do either. I get the same number back several times from PHP's mt_rand() and from mysql's...
9
by: MyInfoStation | last post by:
Hi all, I am a newbie to Python and would like to genereate some numbers according to geometric distribution. However, the Python Random package seems do not have implemented functionality. I am...
1
by: Velhari | last post by:
Hi, I am a beginner. Please tell me, For generating Random Numbers, Initially why we are going for seed method. And another question is that, I want to print unique random number how to print by...
24
by: pereges | last post by:
I need to generate two uniform random numbers between 0 and 1 in C ? How to do it ? I looked into rand function where you need to #define RAND_MAX as 1 but will this rand function give me ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.