0 votes

like the title say it always lands on 7 and i dont know why
here is the code

extends Node
var qtext
var atext
var rand =randi()%10
func _ready():
for x in range(1):
    rand
func questions():
#Questions  
if rand==0:
    qtext="Q1"
if rand==1:
    qtext="Q2"
if rand==2:
    qtext="Q3"
if rand==3:
    qtext="Q4"
if rand==4:
    qtext="Q5"
if rand==5:
    qtext="Q6"
if rand==6:
    qtext="Q7"
if rand==7:
    qtext="Q8"
if rand==8:
    qtext="Q9"
if rand==9:
    qtext="Q10"
return qtext
func answers():
#Answers
if rand==0:
    atext="A1"
if rand==1:
    atext="A2"
if rand==2:
    atext="A3"
if rand==3:
    atext="A4"
if rand==4:
    atext="A5"
if rand==5:
    atext="A6"
if rand==6:
    atext="A7"
if rand==7:
    atext="A8"
if rand==8:
    atext="A9"
if rand==9:
    atext="A10"
return atext
in Engine by (388 points)

1 Answer

0 votes
Best answer
var rand

func _ready():
    randomize()
    rand = randi()%10
by (9,638 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories