-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* @Author: Vincent Young | ||
* @Date: 2024-09-16 11:59:24 | ||
* @LastEditors: Vincent Young | ||
* @LastEditTime: 2024-09-16 12:06:44 | ||
* @FilePath: /DeepLX/translate/utils.go | ||
* @Telegram: https://t.me/missuo | ||
* @GitHub: https://github.com/missuo | ||
* | ||
* Copyright © 2024 by Vincent, All Rights Reserved. | ||
*/ | ||
|
||
package translate | ||
|
||
import ( | ||
"math/rand" | ||
"strings" | ||
"time" | ||
) | ||
|
||
func getICount(translateText string) int64 { | ||
return int64(strings.Count(translateText, "i")) | ||
} | ||
|
||
func getRandomNumber() int64 { | ||
src := rand.NewSource(time.Now().UnixNano()) | ||
rng := rand.New(src) | ||
num := rng.Int63n(99999) + 8300000 | ||
return num * 1000 | ||
} | ||
|
||
func getTimeStamp(iCount int64) int64 { | ||
ts := time.Now().UnixMilli() | ||
if iCount != 0 { | ||
iCount = iCount + 1 | ||
return ts - ts%iCount + iCount | ||
} else { | ||
return ts | ||
} | ||
} |
Oops, something went wrong.