我正在尝试为Java中基于文本的RPG创建骰子滚动类。我是编程和寻求帮助的超级新手。在此先感谢!
import java.util.Random;
public class Dice {
public Random random;
public Dice() {
this.random = new Random();
}
public int roll() {
int rand = random.nextInt(20);
}
System.out.println("\nThe dice rolled a " + rand + ".");
}
答案 0 :(得分:1)
<div class="form-group">
<label for="company-content">Ville</label>
<select name="fk_localite" id="" class="form-control">
@foreach($localites as $localite)
<option value="{{$localite->id}}" @if($eleves->fk_localite == $localite->id) selected @endif>{{ $localite->ville }}
</option>
@endforeach
</select>
</div>
在方法之外println
,它只是rand
方法内的一个变量roll()
方法中返回值您需要类似的东西
roll()