Generate random numbers on page reloading.

December 27, 2011 at 03:54:37
Specs: Windows 7, AMD athlon processor
Hi all. I've created a site. i want to make to generate a numbers from 0-100 on every time page reloads. it is better if javascript, or php coding is used. kindly anybody have idea about this....

See More: Generate random numbers on page reloading.

Report •

#1
January 13, 2012 at 00:30:39
In PHP:
<?php $v1 = rand(0,100); echo $v1; ?>

In JavaScript:
<script>document.write(Math.floor(Math.random() * 101));</script>

Don't be fooled by that 101 in the JavaScript. It will display numbers between and including 0-100.

Apologies if I don't respond to your reply immediately. I don't check this site daily, but you're welcome to PM me as a reminder.


Report •

#2
January 16, 2012 at 09:27:48
Ok. Thanks. But it possible to generate selected numbers on reloading. i.e., i want only 22, 10, 6, 30,[selected numbers].. within 32 numbers.

Report •

#3
January 30, 2012 at 15:16:10
I don't understand what you mean. You first asked to generate random numbers, and now you're want to display specific numbers?

Apologies if I don't respond to your reply immediately. I don't check this site daily, but you're welcome to PM me as a reminder.


Report •
Related Solutions


Ask Question