Jump to content

Random Number, Should be easy!


Snooble

Recommended Posts

<?php 
$_SESSION['point'] = rand(0, 10).".". rand(0, 9) rand(0, 9); 
echo $_SESSION['point'];
?>

 

I want to set a variable (SESSION OR NOT) to a random number. The number needs to be 2 dec places. so i've used 3 random numbers. ?????

 

how can i get it to work? The idea is to add the amount to a mysql cell (easy enough i believe) and then echo the cell out.

 

number should look like this : *.** in the sql table.

 

so: 3.91 or 1.27

 

etc.

 

Thanks,

 

Snooble

Link to comment
https://forums.phpfreaks.com/topic/41016-random-number-should-be-easy/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.