math.random(0,1) Give me 0 or 1.... Suppose to be a integer!!!

number=math.random(0,1)
print(number)

function setup()
number=math.random()
end

function draw()
background(0, 40, 255, 255)
fontSize(200)
text(number,WIDTH/2,HEIGHT/2)
end

This code do not shaw the number!! Why?

The text is to large. If text is larger than the screen, then text doesn’t render anything. Reduce the fontSize, or, what you probably want to do is reduce the number of digits in the number using string.format.

@franck A fontSize of 800 works in the code below because math.random(0,1) returns a single digit, 0 or 1. In your second example, math.random() returns a 14 digit number less than 1. The width of a number can’t exceed the width of the screen or it won’t print as @yojimbo2000 said. So you have to modify fontSize based on the result you want to display.

function setup()
    number=math.random(0,1)
end

function draw()
    background(0, 40, 255, 255)
    fontSize(800)
    text(number,WIDTH/2,HEIGHT/2)
end

or modify the number of digits: text(string.format("%.4f", number), WIDTH/2, HEIGHT/2)