Generating random numbers
#1

I'm trying to make it so when a player types a command it result in a random number, and this number cannot be used again. I'm making a column in database called UCPID and it will have the random number generated in this column. If you wish to show code examples please do, or even an explanation.
Reply
#2

Here's one:
PHP код:
new ucp_id[24], next_sql_id /* next_sql_id = SQL ID of the next INSERT statement */;
format(ucp_idsizeof(ucp_id), "%d%d"gettime(), next_sql_id); 
Reply
#3

Or you could set the primary key to UCPID and add auto increment to it.
Reply
#4

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Or you could set the primary key to UCPID and add auto increment to it.
The reason I suggested the use of timestamp was to simulate "random numbers".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)