lundi 24 août 2020

How to get a random smallint

I am trying to get a random value based on its type.

Examples:

  1. tinyint - rand(0, 255);

  2. int - rand(PHP_INT_MIN, PHP_INT_MAX)

How do I do that with smallint or bigint?

My guess was something like this but it gives me syntax errors and looks terrible:

rand(-2^15*(-32,768) , 2^15-1*(32,767));




Aucun commentaire:

Enregistrer un commentaire