--- loncom/homework/default_homework.lcpm 2016/12/06 20:51:11 1.171
+++ loncom/homework/default_homework.lcpm 2019/04/03 22:46:30 1.172.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
#
-# $Id: default_homework.lcpm,v 1.171 2016/12/06 20:51:11 damieng Exp $
+# $Id: default_homework.lcpm,v 1.172.2.1 2019/04/03 22:46:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -632,16 +632,29 @@ sub hinton {
sub random {
my ($start,$end,$step)=@_;
if ( ! $hidden::RANDOMINIT ) {
- if ($external::randomseed == 0) { $external::randomseed=1; }
- if ($external::randomseed =~/,/) {
- my ($num1,$num2)=split(/,/,$external::randomseed);
- &random_set_seed(1,abs($num1));
- } elsif ($external::randomseed =~/:/) {
- my ($num1,$num2)=split(/:/,$external::randomseed);
- &random_set_seed(abs($num1),abs($num2));
- } else {
- &random_set_seed(1,int(abs($external::randomseed)));
- }
+ if ($external::randomseed == 0) { $external::randomseed=1; }
+ if ($external::randomseed =~/,/) {
+ my ($num1,$num2) = map { abs($_); } split(/,/,$external::randomseed);
+ if ((!$num1) || ($num1 > 2147483398)) {
+ &random_set_seed_from_phrase($external::randomseed);
+ } else {
+ &random_set_seed(1,$num1);
+ }
+ } elsif ($external::randomseed =~/:/) {
+ my ($num1,$num2) = map { abs($_); } split(/:/,$external::randomseed);
+ if ((!$num1) || (!$num2) || ($num1 > 2147483562) || ($num2 > 2147483398)) {
+ &random_set_seed_from_phrase($external::randomseed);
+ } else {
+ &random_set_seed($num1,$num2);
+ }
+ } else {
+ my $num1 = int(abs($external::randomseed));
+ if ((!$num1) || ($num1 > 2147483398)) {
+ &random_set_seed_from_phrase($external::randomseed);
+ } else {
+ &random_set_seed(1,$num1);
+ }
+ }
&math_random_uniform();
$hidden::RANDOMINIT=1;
}
@@ -902,11 +915,19 @@ sub chemparse {
my $formula = '';
foreach my $token (@tokens) {
if ($token eq '->' ) {
- $formula .= '\ensuremath{\rightarrow} ';
+ if ($external::target eq 'web') {
+ $formula .= '→ ';
+ } else {
+ $formula .= '\ensuremath{\rightarrow} ';
+ }
next;
}
if ($token eq '<-' ) {
- $formula .= '\ensuremath{\leftarrow} ';
+ if ($external::target eq 'web') {
+ $formula .= '← ';
+ } else {
+ $formula .= '\ensuremath{\leftarrow} ';
+ }
next;
}
if ($token eq '<=>') {